[英]Server freezes when uploading large sized images in php
I have simple html form with post method, which sends an image to my action.php file: 我有带有post方法的简单html表单,该表单将图像发送到我的action.php文件:
<form action="action.php" method="post" enctype="multipart/form-data">
<input type="text" name="name"/>
<input type="file" name="avatar"/>
<input type="submit" name="submit" value="Create"/>
</form>
And my action.php file looks like this: 我的action.php文件如下所示:
if(isset($_POST['name'])) {
$error = $_FILES['avatar']['error'];
echo $error;
}
It works fine with small sized images, but when I try to submit images with approximately 2mb size the server just stops responding. 它适用于小尺寸的图像,但是当我尝试提交大约2mb大小的图像时,服务器只是停止响应。 It even doesn't send post request to my action.php. 它甚至不发送请求到我的action.php。
Note: I've already set my upload_max_filesize = 64M, but the same thing is happening. 注意:我已经设置了upload_max_filesize = 64M,但是发生了同样的事情。 It doesn't show any errors 它没有显示任何错误
Change the value of post_max_size = 70M
. 更改post_max_size = 70M
的值。 Must be greater than or equal to upload_max_filesize . 必须大于或等于upload_max_filesize 。
After modifying php.ini file(s), you need to restart your HTTP server to use new configuration. 修改php.ini文件后,您需要重新启动HTTP服务器以使用新配置。
If problem persist you could try these solutions ( 1 , 2 , 3 ). 如果问题仍然存在,你可以尝试以下解决方案( 1 , 2 , 3 )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.