philip Fri Jul 12 18:15:30 2002 EDT Modified files: /phpdoc/en/features file-upload.xml Log: Updated the ['error'] constants, which are available as of PHP 4.3.0 ['error'] itself became available in PHP 4.2.0 Index: phpdoc/en/features/file-upload.xml diff -u phpdoc/en/features/file-upload.xml:1.44 phpdoc/en/features/file-upload.xml:1.45 --- phpdoc/en/features/file-upload.xml:1.44 Fri Jul 12 04:16:58 2002 +++ phpdoc/en/features/file-upload.xml Fri Jul 12 18:15:29 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.44 $ --> +<!-- $Revision: 1.45 $ --> <chapter id="features.file-upload"> <title>Handling file uploads</title> @@ -225,60 +225,64 @@ <sect1 id="features.file-upload.errors"> <title>Error Messages Explained</title> <simpara> - 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 <link linkend="ini.register-globals"> - register_globals</link> 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 + <emphasis>["error"]</emphasis> segment of the file array that is created + during the file upload by PHP. In otherwords, the error might be + found in <varname>$_FILES['userfile']['error']</varname>. An example: </simpara> <para> <variablelist> <varlistentry> - <term><varname>UPLOAD_ERROR_A</varname></term> + <term><varname>UPLOAD_ERROR_OK</varname></term> <listitem> <para> - 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. </para> </listitem> </varlistentry> <varlistentry> - <term><varname>UPLOAD_ERROR_B</varname></term> + <term><varname>UPLOAD_ERROR_INI_SIZE</varname></term> <listitem> <para> - 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 + <link ini="ini.upload-max-filesize">upload_max_filesize</link> + directive in &php.ini;. </para> </listitem> </varlistentry> <varlistentry> - <term><varname>UPLOAD_ERROR_C</varname></term> + <term><varname>UPLOAD_ERROR_FORM_SIZE</varname></term> <listitem> <para> - Value: 3; the uploaded file was only partially uploaded. + Value: 2; The uploaded file exceeds the <emphasis>MAX_FILE_SIZE</emphasis> + directive that was specified in the html form. </para> </listitem> </varlistentry> <varlistentry> - <term><varname>UPLOAD_ERROR_D</varname></term> + <term><varname>UPLOAD_ERROR_PARTIAL</varname></term> <listitem> <para> - Value: 4; no file was uploaded. + Value: 3; The uploaded file was only partially uploaded. </para> </listitem> </varlistentry> <varlistentry> - <term><varname>UPLOAD_ERROR_E</varname></term> + <term><varname>UPLOAD_ERROR_NO_FILE</varname></term> <listitem> <para> - Value: 5; the uploaded file has a size of 0 (read: zero) bytes. + Value: 4; No file was uploaded. </para> </listitem> </varlistentry> </variablelist> - </para> + </para> + <para> + <note> + These became PHP constants in PHP 4.3.0 + </note> + </para> </sect1> <sect1 id="features.file-upload.common-pitfalls">
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php