目前我的php验证如下
if ($_FILES["file"]["size"] > 5120)
{
$_SESSION['error'] = 'Upload FAILED, file is too large !';
header("Location: upload.php");
exit;
}
但这似乎并没有阻止任何大型文件上传!任何帮助非常感谢!!
答案 0 :(得分:1)
使用此选项限制上传文件大小:
$max_size = /* whatever */; //File Size in Bytes
if(filesize($_FILES['userfile']['tmp_name']) > $max_size) {
die('The file you uploaded is too large.');
}
答案 1 :(得分:0)
使用upload_max_filesize
可以在php.ini,.htaccess,httpd.conf或.user.ini中设置条目
http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize