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

Bug #4441 inaccurate error when uploading large file
Submitted: 2005-05-26 13:42 UTC
From: glen at delfi dot ee Assigned: antonio
Status: Closed Package: HTTP_Upload
PHP Version: 5.0.4 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-05-26 13:42 UTC] glen at delfi dot ee
Description: ------------ i have file uploaded which exceeds the upload_max_filesize diretive the object returns me NO_USER_FILE error. but inspecting $_FILES['userfile']['error'] it means that limit was reached instead. and secondly there's new error type available since 4.3.10: http://www.php.net/manual/en/features.file-upload.errors.php Reproduce code: --------------- set these php.ini variables: post_max_size = 8M upload_max_filesize = 2M and upload 3MB file. btw the $error is filled properly with TOO_LARGE constant and passed to HTTP_Upload_File() $files[$formname] = new HTTP_Upload_File($name, $tmp_name, $formname, $type, $size, $error, $this->lang, $this->_chmod); but the constructor marks missing size instantly as NO_USER_FILE: if (empty($name) || $size == 0) { $error = 'NO_USER_FILE'; } elseif ($tmp == 'none') { $error = 'TOO_LARGE'; here i also provide suggested code fix for the missing constant: // map error codes from 4.2.0 $_FILES['userfile']['error'] if (function_exists('version_compare') && version_compare(phpversion(), '4.2.0', 'ge')) { $uploadError = array( 1 => 'TOO_LARGE', 2 => 'TOO_LARGE', 3 => 'PARTIAL', 4 => 'NO_USER_FILE' ); if (version_compare(phpversion(), '4.3.10', 'ge')) { $uploadError[6] = 'NO_TMP_DIR'; } } Expected result: ---------------- isError() should return TOO_LARGE not NO_USER_FILE error. Actual result: -------------- error from upload says: NO_USER_FILE

Comments

 [2005-06-03 19:21 UTC] antonio
Can you please check if the error occurs with the cvs version?
 [2005-06-06 13:58 UTC] glen at delfi dot ee
 [2005-06-07 13:06 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 pear.php.net. In case this was a pear.php.net 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.