Home > Backend Development > PHP Tutorial > PHP file upload error message description

PHP file upload error message description

伊谢尔伦
Release: 2016-11-22 10:29:41
Original
1473 people have browsed it

Starting from PHP 4.2.0, PHP will return a corresponding error code along with the file information array. This code can be found in the error field in the file array generated when the file is uploaded, that is, $_FILES['userfile']['error'].

UPLOAD_ERR_OK

The value is 0, no error occurs, and the file is uploaded successfully.

UPLOAD_ERR_INI_SIZE

The value is 1, and the uploaded file exceeds the limit of the upload_max_filesize option in php.ini.

UPLOAD_ERR_FORM_SIZE

The value is 2, and the size of the uploaded file exceeds the value specified by the MAX_FILE_SIZE option in the HTML form.

UPLOAD_ERR_PARTIAL

The value is 3, only part of the file is uploaded.

UPLOAD_ERR_NO_FILE

The value is 4, no file was uploaded.

UPLOAD_ERR_NO_TMP_DIR

The value is 6 and the temporary folder cannot be found. Introduced in PHP 4.3.10 and PHP 5.0.3.

UPLOAD_ERR_CANT_WRITE

The value is 7, file writing failed. Introduced in PHP 5.1.0.

Note:

The above values ​​became PHP constants after PHP 4.3.0.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template