Hi, I have hit a bit of a hiccup!
Doing some testing before completing a file upload, and my problem is the opposite to most file size troubles! I want to put a limit on the size a user can upload, and to do this I have put a size limit of 3KB (as suggested in David Powers’ excellent guide PHP Solutions)
However, when I do upload a bigger file than this, it still gets uploaded, even though it shouldn’t! As he suggests, I have the size-checking code at the top of the doc and a hidden field before the file input box. Hidden field goes:
<input type="hidden" name="maxfilesize" value="<?php echo maxfilesize; ?>" />
and the size checking routine goes:
define('maxfilesize', 3000);
But I don’t see anywhere the file size actually gets checked in order to prevent a file larger than the 3KB from being uploaded. I can’t see how making a string with a name equal to the defined constant can actually do anything. I have used David Powers’ code throughout (apart from putting the constant name in lowercase and leaving out his underscores)
Also, for the value attribute, why can this not simply be value=“maxfilesize”? Why the echo statement?