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; }