錯(cuò)誤信息說明

PHP 將隨文件信息數(shù)組一起返回一個(gè)對應(yīng)的錯(cuò)誤代碼。該代碼可以在文件上傳時(shí)生成的文件數(shù)組中的 error 字段中被找到,也就是 $_FILES['userfile']['error']。

UPLOAD_ERR_OK

其值為 0,沒有錯(cuò)誤發(fā)生,文件上傳成功。

UPLOAD_ERR_INI_SIZE

其值為 1,上傳的文件超過了 php.iniupload_max_filesize 選項(xiàng)限制的值。

UPLOAD_ERR_FORM_SIZE

其值為 2,上傳文件的大小超過了 HTML 表單中 MAX_FILE_SIZE 選項(xiàng)指定的值。

UPLOAD_ERR_PARTIAL

其值為 3,文件只有部分被上傳。

UPLOAD_ERR_NO_FILE

其值為 4,沒有文件被上傳。

UPLOAD_ERR_NO_TMP_DIR

其值為 6,找不到臨時(shí)文件夾。PHP 5.0.3 引進(jìn)。

UPLOAD_ERR_CANT_WRITE

其值為 7,文件寫入失敗。PHP 5.1.0 引進(jìn)。

UPLOAD_ERR_EXTENSION

Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0.