Home  >  Article  >  Backend Development  >  Explanation of error in php $_file

Explanation of error in php $_file

巴扎黑
巴扎黑Original
2016-11-24 11:54:192372browse

When uploading files using PHP, we will use a program to monitor the file information sent by the browser. First, we will judge whether the status of the file to be uploaded is normal through the different values ​​​​of $_FILES[fieldName]['error']. $_FILES[fieldName] ['error']==0 means everything is normal. For the specific meaning of other values, please refer to the comment section of the program below!

switch($_FILES[$field]['error']) {  
    case 1:    
// 文件大小超出了服务器的空间大小    
break;   
case 2:    
// 要上传的文件大小超出浏览器限制    
$this->setError("The file is too large (form).");    
break;    
case 3:    
// 文件仅部分被上传    
$this->setError("The file was only partially uploaded.");    
break;    
case 4:    
// 没有找到要上传的文件    
break;    
case 5:    
// 服务器临时文件夹丢失    
break;    
case 6:    
// 文件写入到临时文件夹出错    
break;    
}


Statement:
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