0

Iam trying to upload a file using php. I can upload.zip files up to 3 mb . But can't upload files >3mb. It take a lot of time to submit the html form. I have checked the upload and memory details using the following code.

$max_upload = (int)(ini_get('upload_max_filesize'));
$max_post = (int)(ini_get('post_max_size'));
$memory_limit = (int)(ini_get('memory_limit'));
$upload_mb = min($max_upload, $max_post, $memory_limit);

And it gives the out put as

max_upload=10
memory_limit=64
upload_mb=10

Please help me to find out the solution.

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
user1467983
  • 47
  • 2
  • 6

4 Answers4

1

It could also be the webserver, see LimitRequestBody for apache or client_max_body_size for nginx

Another reason would be proxy (transparent proxy?). You can test that by asking someone else to try uploading the file

disjunction
  • 646
  • 5
  • 8
0

Have you checked the timeout for your scripts? By default is 30 sec... Maybe that's the limit...

napolux
  • 15,574
  • 9
  • 51
  • 70
  • File upload time doesn't count toward the maximum execution time of PHP scripts. –  Jun 21 '12 at 13:23
  • I have inserted the code set_time_limit(1000); at the top of the php script, but same result. By problem is that control is not coming to the php script. – user1467983 Jun 21 '12 at 13:30
0

since it takes a lot of time may be you are exceeding the 30 secon timeout

you can alter it by adding

like

    set_time_limit(60);

from http://php.net/manual/en/function.set-time-limit.php

and run this code

 <?php
     phpinfo();  ?>

Run that file to get your system settings (search for upload_max_filesize, etc);

Rinzler
  • 2,139
  • 1
  • 27
  • 44
0

I gave the same answer to a previous PHP large file upload question, but the answer still applies:

For large files, if you don't want to have to deal with configuring server settings (particularly if you are on shared hosting or some other hosting that doesn't give you full control over the server), one potential solution is to hand the upload off to a third party service.

For example, you could have the form do a direct post to Amazon S3 (http://s3.amazonaws.com/doc/s3-example-code/post/post_sample.html) or use a service like Filepicker.io

Full disclosure: I work at Filepicker.io, but want to help out folks who are dealing with issues doing large file uploads

brettcvz
  • 2,371
  • 1
  • 13
  • 14