这是我的上传表格:
<form action="uploads.php" method="post" enctype="multipart/form-data">
<input name="fileupload" type="file" multiple>
<button>Upload</button>
</form>
我的最大上传大小设置如下:
; Maximum allowed size for uploaded files.
upload_max_filesize = 5M
; Must be greater than or equal to upload_max_filesize
post_max_size = 5M
如果我上传一个更大的文件,那么 5Mvar_dump($_FILES)
是空的。我可以这样做:
if($_FILES){
echo "Upload done!";
}
$_FILES
如果文件大于 5M,则不设置。但这有点奇怪。你会怎么做?
编辑:
超过 5M 的文件的 var_dump:
array(0) {
}
文件的 var_dump <= 5M:
array(1) {
["fileupload"]=>
array(5) {
["name"]=>
string(13) "netzerk12.pdf"
["type"]=>
string(15) "application/pdf"
["tmp_name"]=>
string(22) "/tmp/uploads/phpWhm8M0"
["error"]=>
int(0)
["size"]=>
int(352361)
}
}