【发布时间】:2012-08-08 13:39:37
【问题描述】:
可能重复:
POST Content-Length exceeds the limit
PHP Warning: POST Content-Length of 113 bytes exceeds the limit of -1988100096 bytes in Unknown
我有上传图片的表单,我正在测试,如果我上传图片,例如 9 mb 大小,php 返回错误:
POST Content-Length of 10194008 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
我希望不要上传超过 2 mb 的文件,在第一行我有这个代码:
if (!empty($_FILES['main_photo']['name'])) {
if ( $_FILES['main_photo']['size'] > 1024 * 1024 * 2 ) {
header("Location: index.php");
exit();
}
}
但是还是会出现这个错误,请告诉什么make,如果文件超过2mb,我想要,只是:
header("Location: index.php");
【问题讨论】:
-
你应该先检查
$_FILES['main_photo']['error']
标签: php file-upload