gpt4 book ai didi

php - $ _FILES ['file'] ['size']对于上载超过max_filesize的文件,回显0(零)

转载 作者:行者123 更新时间:2023-12-03 08:04:42 25 4
gpt4 key购买 nike

问题是我想检查文件是否太大而无法上传,以便可以显示相关的错误消息,但是当文件大于php.ini中的upload_max_filesize时,它似乎仅显示0。

为什么会这样呢?如何测试文件太大而无法给出相关错误?

最佳答案

参见http://php.net/manual/en/features.file-upload.errors.php

相关摘录:

Since PHP 4.2.0, PHP returns an appropriate error code along with the file array. The error code can be found in the error segment of the file array that is created during the file upload by PHP. In other words, the error might be found in $_FILES['userfile']['error'].

UPLOAD_ERR_OK Value: 0; There is no error, the file uploaded with success.

UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

关于php - $ _FILES ['file'] ['size']对于上载超过max_filesize的文件,回显0(零),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2275143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com