From ad6c85a00030f3efeb9eb9569a23992a253ab525 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Fri, 12 Jul 2002 22:15:29 +0000 Subject: [PATCH] Updated the ['error'] constants, which are available as of PHP 4.3.0 ['error'] itself became available in PHP 4.2.0 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@88514 c90b9560-bf6c-de11-be94-00142212c4b1 --- features/file-upload.xml | 46 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/features/file-upload.xml b/features/file-upload.xml index 54037eeca6..c4f8ba0597 100644 --- a/features/file-upload.xml +++ b/features/file-upload.xml @@ -1,5 +1,5 @@ - + Handling file uploads @@ -225,60 +225,64 @@ move_uploaded_file($_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file 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"]. + Since PHP 4.2.0, PHP returns an appropriate error code along with the + file array. The error code can be found in the + ["error"] segment of the file array that is created + during the file upload by PHP. In otherwords, the error might be + found in $_FILES['userfile']['error']. An example: - UPLOAD_ERROR_A + UPLOAD_ERROR_OK - Value: 1; the uploaded file exceeds the upload_max_filesize directive - that is specified in &php.ini;. + Value: 0; There is no error, the file uploaded with success. - UPLOAD_ERROR_B + UPLOAD_ERROR_INI_SIZE - Value: 2; the uploaded file exceeds the MAX_FILE_SIZE directive - that was specified in the html form. + Value: 1; The uploaded file exceeds the + upload_max_filesize + directive in &php.ini;. - UPLOAD_ERROR_C + UPLOAD_ERROR_FORM_SIZE - Value: 3; the uploaded file was only partially uploaded. + Value: 2; The uploaded file exceeds the MAX_FILE_SIZE + directive that was specified in the html form. - UPLOAD_ERROR_D + UPLOAD_ERROR_PARTIAL - Value: 4; no file was uploaded. + Value: 3; The uploaded file was only partially uploaded. - UPLOAD_ERROR_E + UPLOAD_ERROR_NO_FILE - Value: 5; the uploaded file has a size of 0 (read: zero) bytes. + Value: 4; No file was uploaded. - + + + + These became PHP constants in PHP 4.3.0 + +