我使用php将文件上传到数据库。我可以知道为什么上传时我没有达到任何数量的尺寸吗?当我print_r($_FILES)
返回大小时:
Array
(
[uploaded] => Array
(
[name] => Array
(
[0] => f2-CP-2016.pdf
[1] =>
[2] =>
)
[size] => Array
(
[0] => 0
[1] => 0
[2] => 0
)
我上传了一个文件,但大小仍然返回0.我想对size > 3MB
进行验证,它会返回错误。以下是我的代码:
for($i=0; $i < count($_FILES['uploaded']['name']); $i++){
$array = array($_FILES['uploaded']['name']);
$tmpFilePath = $_FILES['uploaded']['tmp_name'][$i];
$filesize_upload = $_FILES['uploaded']['size'][$i];
if($filesize_upload > 3145728){
die('File is BIG');
} else {
//proceed to upload
}
}
更新错误:
这是我收到的错误
[error] => Array
(
[0] => 1
[1] => 4
[2] => 4
)