RE: MAX_FILE_SIZE not working with file uploads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the  To: php-general@xxxxxxxxxxxxx> Date: Thu, 20 Sep 2007 14:45:36 -0500> From: jeff@xxxxxxxxxxxx> Subject:  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]>  enctype="multipart/form-data" name="upload" id="upload">> > Filename on your PC:> > Please click ONCE and be patient:> > > [/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>

_________________________________________________________________
Can you find the hidden words?  Take a break and play Seekadoo!
http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux