-1

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?

Jørgen R
  • 10,568
  • 7
  • 42
  • 59
ElLelero
  • 80
  • 1
  • 10
  • Are you using a shared hosting? Can you check the configuration using – m4n0 May 11 '15 at 10:36
  • Here the details of my php.ini. [Part one](http://s17.postimg.org/7fb31mcjz/details1.png) [Part two](http://s17.postimg.org/wzhylsnbj/details2.png) – ElLelero May 11 '15 at 10:54
  • Ok, that looks fine. Did you check the error logs? – m4n0 May 11 '15 at 10:55
  • No I didn't. Do I have to check the httpd error log? – ElLelero May 11 '15 at 10:57
  • Yes `/usr/local/apache/logs/error_log` Here – m4n0 May 11 '15 at 11:00
  • Are you using some framework for upload? I think there something makes redirects... – Phoebus May 11 '15 at 11:04
  • There are many notice messages about SIGTERM, I think because of the restarts I made when I edited the file php.ini. There are no other messages. – ElLelero May 11 '15 at 11:05
  • @Phoebus No, I'm not using frameworks. I work with the input type file and a code written in JavaScript (it uses an XMLHttpRequest). – ElLelero May 11 '15 at 11:07
  • Did you checked out what is written at file upload on server side (PHP)? maybe there is some conditions on file size. Also check out in Chrome developer tools -> Network, what status and response returns that page while trying to upload. – Phoebus May 11 '15 at 11:24
  • In the PHP upload file I set a file size check, I will remove it and then I will try again. I will check also the status of the page and then I will let you know. Thank you for the moment. – ElLelero May 11 '15 at 11:45

1 Answers1

0

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.

Shahar
  • 3,692
  • 4
  • 25
  • 47
ElLelero
  • 80
  • 1
  • 10
  • See the link here for a detailed explanation of what limit an upload: http://stackoverflow.com/questions/9004544/what-is-the-maximum-file-upload-size-with-xmlhttprequest-level-2 – ElLelero May 11 '15 at 12:30