PHP - Upload file reset

2019-09-20 01:57发布

问题:

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?

回答1:

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.