当上传的文件超过php_post_max_size时如何显示错误? [英] How to display an error when the uploaded files are exceeding post_max_size php?

查看:196
本文介绍了当上传的文件超过php_post_max_size时如何显示错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当上传的文件超过post_max_size php时如何显示错误?

How to display an error when the uploaded files are exceeding post_max_size php?

print_r($_FILES);

当我超过post_max_size

array()

我是从php.net上获得的,但我不理解,也不知道该怎么做,

I got this from php.net but I don't understand it and don't know how to do it,

如果发布数据的大小大于post_max_size,则$ _POST和 $ _FILES个超级全局变量为空.这可以通过各种方式进行跟踪, 例如通过将$ _GET变量传递给处理数据的脚本, 即,然后检查是否 设置了$ _GET ['processed'].

If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. , and then checking if $_GET['processed'] is set.

这是我的表格,

<form action="upload.php" method="post" enctype="multipart/form-data">
  <input type="file" multiple="multiple" name="file[]" />
  <input type="submit" name="upload" value="Submit"/>
</form>

推荐答案

如果$_SERVER['CONTENT_LENGTH']不为零,并且$_POST$_FILES为空,则上载太大.

If $_SERVER['CONTENT_LENGTH'] is non zero and $_POST and $_FILES are empty, then the upload was too big.

这篇关于当上传的文件超过php_post_max_size时如何显示错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆