Max file size is a hint to the browser and not all support it...you can't count
on it
bastien
> To: php-general@lists.php.net> Date: Thu, 20 Sep 2007 14:45:36 -0500> From:
> [EMAIL PROTECTED]> Subject: [PHP] MAX_FILE_SIZE not working with file
> uploads> > The punchline question is: What am I missing?> > Now for the
> details.> > I have a form through which a user uploads image files. In the
> event> the chosen file exceeds the MAX_FILE_SIZE (which I have included as> a
> hidden form field immediately after the form tag), I want to abort> the
> upload process and display an appropriate error message to the> user,
> including the size of the file s/he attempted to upload.> > But that doesn't
> seem to be working.> > Instead, the computer chugs along and then properly
> refuses to> perform the upload, but not immediately. > > And here is the dump
> of the $_FILES array (which, notably, reports> zero as the size):> > [code]>
> Array> (> [userfile] => Array> (> [name] => beach_iStock_000000112348_L2.jpg>
> [type] => > [tmp_name] => > [error] => 2> [size] => 0> )> > )> [/code]> > The
> file (about 1.2MB) DOES upload when I increase the MAX_FILE_SIZE> value to
> 2000000.> > This, from PHP.net:> [quote]> The MAX_FILE_SIZE hidden field
> (measured in bytes) must precede the> file input field, and its value is the
> maximum filesize accepted by> PHP. Fooling this setting on the browser side
> is quite easy, so> never rely on files with a greater size being blocked by
> this> feature. The PHP settings for maximum-size, however, cannot be> fooled.
> This form element should always be used as it saves users> the trouble of
> waiting for a big file being transferred only to find> that it was too big
> and the transfer failed.> [/quote]> > > Here is the form code:> > [code]>
> <form action="__URL__?action=sent" method="post">
> enctype="multipart/form-data" name="upload" id="upload"> > <input
> type="hidden" name="MAX_FILE_SIZE" value="1024000"> > Filename on your PC:>
> <input name="userfile" type="file" size="45"> > Please click ONCE and be
> patient:> <input name="Submit" type="submit" id="Submit" value="Upload File">
> > </form>> [/code]> > > > Pertinent php.ini settings:> version = 4.3.10>
> file_uploads = on> upload_max_filesize = 2M> post_max_size = 8M> > Any
> guidance would be appreciated.> > Jeff> > -- > PHP General Mailing List
> (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE