PHP - 上传文件重置 [英] PHP - Upload file reset

查看:392
本文介绍了PHP - 上传文件重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP 面临上传问题。我使用表单和HTML提供的输入类型文件上传文件,我必须上传大文件( max size 500MB )。



我编辑了我的php.ini文件这样:

  max_execution_time = 7200; 
max_input_time = 7200;
memory_limit = 500M;
post_max_size = 500M;
upload_max_filesize = 500M。

在过去的几周里,我使用小文件( 20 MB ),上传工作正常。
现在我想模拟最坏的情况,当用户不得不上传大文件。我注意到,当用户试图上传大于100MB的文件时,上传重置。
页面接收 2048000字节,然后从0重新开始,当它重新达到 2048000字节。这发生了几次,然后上传停止。

我也试着编辑我的httpd.conf添加行:

  LimitRequestBody 524288000 

问题仍然存在。如何解决这个问题?

解决方案

我发现问题所在。

b
$ b

我从来没有检查 nginx.conf文件



一个名为 client_max_body_size 的选项必须被编辑。



在我的情况下,它被设置为 100m(100MB),我将它改为 500m ,我解决了这个问题。


I'm facing an upload issue using PHP.

I upload the file using a form and the input type file provided from HTML, and I have to upload large files (max size 500MB).

I have edited my php.ini file in this way:

max_execution_time = 7200;
max_input_time = 7200;
memory_limit = 500M;
post_max_size = 500M;
upload_max_filesize = 500M.

I made many tests during the last weeks using small files (20 MB) and the upload was working fine. Now I want to simulate the worst situation, when the user have to upload large files. I noticed that when the user tries to upload files larger than 100MB the upload "resets". The page receives 2048000 bytes, then it restart from 0 and again, it resets when it reach 2048000 bytes. This happens for a couple of times then the upload stops.

I tried also to edit my httpd.conf adding the line:

LimitRequestBody 524288000

The problem is still present. How can I solve this?

解决方案

I found what the problem was.

I never checked the nginx.conf file.

There is the an option called client_max_body_size that has to be edited.

In my case it was set to 100m (100MB), I changed it to 500m and I solved the problem.

这篇关于PHP - 上传文件重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆