This is the tracker for the Core of the Nucleus CMS-project (Nucleus CMS Website)
FS#97 — media library: "bad request" error when file size too large
Attached to Project— Nucleus Core
Opened by Wouter Demuynck (karma) - Monday, 05 September 2005, 08:31PM
Opened by Wouter Demuynck (karma) - Monday, 05 September 2005, 08:31PM
| Bug | |
| Functionality | |
| CLOSED | |
| Wouter Demuynck | |
| All |
| Medium | |
| Normal | |
| CVS | |
| Undecided | |
| Undecided | |
|
|
While trying to upload a rather large file, I ended up with a "bad upload request" error returned by Nucleus.
After investigation, it turned out that PHP version > 4.2.0 have an 'error' entry in the $_FILES entries (http://be.php.net/manual/en/features.file-upload.errors.php), which in my case indicated that "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."
We should check this error info in media.php
UPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success.
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.
UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded.
UPLOAD_ERR_NO_TMP_DIR
Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
UPLOAD_ERR_CANT_WRITE
Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
After investigation, it turned out that PHP version > 4.2.0 have an 'error' entry in the $_FILES entries (http://be.php.net/manual/en/features.file-upload.errors.php), which in my case indicated that "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."
We should check this error info in media.php
UPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success.
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.
UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded.
UPLOAD_ERR_NO_TMP_DIR
Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
UPLOAD_ERR_CANT_WRITE
Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
This task depends upon
This task blocks these from closing
Date: Monday, 05 September 2005, 08:43PM
Reason for closing: Fixed
Additional comments about closing: in CVS
In CVS now.
- The problems with filesizes are translated to _ERROR_FILE_TOO_BIG
- Other problems are translated to _ERROR_BADREQUEST . ' (' . $fileerror . ')'. I think it makes sense _not_ to create specifi language constants for these error, since I don't expect them to occur often. Instead, the error code which is added to the error message can help to find the error cause more easily.