如何在PHP中查看$\u文件数组中的错误消息
我正在使用多文件上载功能,当我将文件数组打印为以下格式时,会出现错误:如何在PHP中查看$\u文件数组中的错误消息,php,cakephp,file-upload,Php,Cakephp,File Upload,我正在使用多文件上载功能,当我将文件数组打印为以下格式时,会出现错误: print_r($_FILE); 获取错误为: Array ( [name] => _agiewniki_Forrest_in_Autumn.jpg [type] => [tmp_name] => [error] => 1 [size] => 0 ) 我没有看到错误描述,错误仅限于此 [error] => 1 上载\u错误\u INI\u大小 价值
print_r($_FILE);
获取错误为:
Array
(
[name] => _agiewniki_Forrest_in_Autumn.jpg
[type] =>
[tmp_name] =>
[error] => 1
[size] => 0
)
我没有看到错误描述,错误仅限于此
[error] => 1
上载\u错误\u INI\u大小
价值:1;上载的文件超出了php.ini中的upload\u max\u filesize指令
希望对您有所帮助
上载\u错误\u INI\u大小
价值:1;上载的文件超出了php.ini中的upload\u max\u filesize指令
希望对您有所帮助您可以通过错误代码找到说明
您的情况是:上传的文件超过了php.ini中的upload\u max\u filesize指令。
您可以通过错误代码找到描述
在您的情况下是:
上载的文件超过了php.ini中的upload\u max\u filesize指令。
基于$\u FILES['userfile']['error']
值,您可以在ref文档中打印相应的错误消息
使用相应的错误键值在某个数组中添加所有错误消息。基于上载期间从$\u文件
接收到的错误键值,并显示相应的错误消息[下面添加的链接]
已解释错误消息:
误差值:1;上载的文件超出了php.ini中的upload\u max\u filesize指令
有关更多信息&Ref:根据
$\u文件['userfile']['error']
值,您可以在Ref文档中打印相应的错误消息
使用相应的错误键值在某个数组中添加所有错误消息。基于上载期间从$\u文件
接收到的错误键值,并显示相应的错误消息[下面添加的链接]
已解释错误消息:
误差值:1;上载的文件超出了php.ini中的upload\u max\u filesize指令
有关详细信息&Ref:您可以使用此阵列显示:
您可以使用此阵列显示:
谢谢@Danijel的详细回答谢谢@Danijel的详细回答
$error_messages = array(
UPLOAD_ERR_OK => 'There is no error, the file uploaded with success',
UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
UPLOAD_ERR_PARTIAL => 'The uploaded file was only partially uploaded',
UPLOAD_ERR_NO_FILE => 'No file was uploaded',
UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder',
UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk',
UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the file upload',
);
// prints "The uploaded file exceeds the upload_max_filesize directive in php.ini"
echo $error_messages[$_FILES['error']];