Detailed explanation of error return value in PHP $_FILES_PHP tutorial

WBOY
Release: 2016-07-13 10:39:51
Original
1044 people have browsed it

$_FILES['file']['error'] value

UPLOAD_ERR_OK: 0 //Normal, upload successful

UPLOAD_ERR_INI_SIZE: 1 //The uploaded file size exceeds the maximum value allowed by the server. Set the value of the upload_max_filesize option limit in php.ini

UPLOAD_ERR_FORM_SIZE: 2 //The upload file size exceeds the value specified by the MAX_FILE_SIZE option in the hidden field in the HTML form

UPLOAD_ERR_NO_TMP_DIR: 6 //No found Temporary folder

UPLOAD_ERR_CANT_WRITE: 7 //File writing failed

UPLOAD_ERR_EXTENSION: 8 //php file upload extension is not opened

UPLOAD_ERR_PARTIAL: 3 //Only part of the file is Upload

Copy code The code is as follows:

switch($_FILES[$field]['error']) {

case 1:
// The file size exceeds the server’s space.
$this->setError("The file is too large (server).");
break;

case 2:
// The size of the file to be uploaded exceeds the browser limit.
$this->setError("The file is too large (form).");
break;

case 3:
// The file was only partially uploaded.
$this->setError("The file was only partially uploaded.");
break;

case 4:
// The file to be uploaded was not found.
$this->setError("No file was uploaded.");
break;

case 5:
/ / The servers temporary folder is missing.
$this->setError("The servers temporary folder is missing.");
break; An error occurred in the temporary folder
$this->setError("Failed to write to the temporary folder.");
break;



http://www.bkjia.com/PHPjc/728100.html

www.bkjia.comtrue

http: //www.bkjia.com/PHPjc/728100.htmlTechArticle$_FILES['file']['error'] value UPLOAD_ERR_OK: 0 //Normal, upload successful UPLOAD_ERR_INI_SIZE: 1 //The uploaded file size exceeds the maximum allowed by the server. Set upload_max_... in php.ini
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!