如果上传文件大小为20-22MB,就可以了。上传成功率100%。
但是,如果我尝试上传大小为50MB的文件,则上传过程在17-20-22-24MB(随机)之后停止,没有任何错误,我在Inspect元素->网络-“已传输”中看到了这些MB
cPanel,.php.ini和 phpinfo(); 中的PHP(5.6)设置相同:
session.gc_maxlifetime = 1440
max_input_time = -1
max_execution_time = -1
upload_max_filesize = 128M
post_max_size = 265M
memory_limit = 2G
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
</form>
</body>
</html>
upload.php:
<?PHP
if(!empty($_FILES['uploaded_file']))
{
$path = "";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
echo "The file ". basename( $_FILES['uploaded_file']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>
如何查看为什么不上传?
答案 0 :(得分:0)
也许需要增加memory_limit选项?