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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-06-06 13:58 UTC] glen at delfi dot ee
 [2005-06-07 13:06 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!