Error Messages Explained

There is a lot that can go wrong during a file upload. PHP returns apropriate error messages beside the usual warnings. The error message can be found in the ["error"] segment of the array that is created during the file upload. This is either $userfile["error"] if register_globals is turned on in php.ini, or $HTTP_POST_FILES["userfile"]["error"] for PHP versions before 4.1.0, or at last and mostly recommended $_FILES["userfile"]["error"].

UPLOAD_ERROR_A

Value: 1; the uploaded file exceeds the upload_max_filesize directive that is specified in php.ini.

UPLOAD_ERROR_B

Value: 2; the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form.

UPLOAD_ERROR_C

Value: 3; the uploaded file was only partially uploaded.

UPLOAD_ERROR_D

Value: 4; no file was uploaded.

UPLOAD_ERROR_E

Value: 5; the uploaded file has a size of 0 (read: zero) bytes.