错误信息说明

PHP 将随文件信息数组一起返回一个对应的错误代码。该代码可以在文件上传时生成的文件数组中的 error 字段中被找到,也就是 $_FILES['userfile']['error']

UPLOAD_ERR_OK

其值为 0,没有错误发生,文件上传成功。

UPLOAD_ERR_INI_SIZE

其值为 1,上传的文件超过了 php.iniupload_max_filesize 选项限制的值。

UPLOAD_ERR_FORM_SIZE

其值为 2,上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值。

UPLOAD_ERR_PARTIAL

其值为 3,文件只有部分被上传。

UPLOAD_ERR_NO_FILE

其值为 4,没有文件被上传。

UPLOAD_ERR_NO_TMP_DIR

其值为 6,找不到临时文件夹。

UPLOAD_ERR_CANT_WRITE

其值为 7,文件写入失败。

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.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top