Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0b4

Bug #2251 Wrong error message if file is larger than MAX_FILE_SIZE
Submitted: 2004-08-30 15:42 UTC
From: mike Assigned: antonio
Status: Closed Package: HTTP_Upload
PHP Version: Irrelevant OS: N/A
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 5 + 19 = ?

 [2004-08-30 15:42 UTC] mike
Description: ------------ If a file gets uploaded which is larger than MAX_FILE_SIZE, HTTP_Upload returns "You haven't selected any file for uploading" instead of "... too large ...". Reproduce code: --------------- <?php require_once 'PEAR.php'; require_once 'HTTP/Upload.php'; PEAR::setErrorHandling(PEAR_ERROR_PRINT, '<pre>%s</pre>'); if (count($_FILES)) { $u = &new HTTP_Upload; $f = &$u->getFiles('upload'); if (!$f->isError()) { $f->moveTo('/tmp'); } } ?> <html> <form action="?" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="1234"> <input type="file" name="upload"> <input type="submit"> </form> </html> Expected result: ---------------- An error message saying the file was too large. Actual result: -------------- Upload error: You haven't selected any file for uploading. Upload error: You haven't selected any file for uploading.


 [2004-08-30 15:44 UTC] wenz
I think that PHP nukes the file when its size is greater than the MAX_FILE_SIZE specified, but I will have to check.
 [2004-08-30 17:40 UTC] mike
I thought so, too... but in fact PHP populates an error within the $_FILES array: Array ( [upload] => Array ( [name] => Windows Sicherheit.pdf [type] => [tmp_name] => [error] => 2 [size] => 0 ) )
 [2004-08-30 17:48 UTC] antonio
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.