2

I have always had issues with Large file uploading with PHP.

I heard that Perl is an alternative and a reliable way of handling large file uploads.

or Is there a better way in php (using swfupload etc) to manage large file uploads.

Do you have any idea about this?

Thanks, B2W 2011

B2w2011
  • 21
  • 1

4 Answers4

1

There are 3 configuration options that affects file uploading in php, all of them in php.ini, and some of them configurable at runtime.

You should take care of:

**max_input_time** its the time a script could invest in parsing the input
**file_uploads should** be set to on, it determines if uploads are allowed at all or not
**upload_max_filesize** is the maximum size for the uploaded files
**post_max_size** since uploads are inside POST requests, you should raise this value at least to the value you specified in upload_max_filesize

After you change this settings in php.ini, remember to restart apache.

It is also adviced to remove the max execution time limitation with:

set_time_limit(0); at code level.

Aside from that, remember that if you upload large files, you should never put the content of the files directly inside a variable, you would run out of memory if you do it.

jcarlosn
  • 398
  • 1
  • 4
0

Normally when you disable the timeout limit using set_time_limit(0)it should not produce any errors.

Kenny
  • 5,350
  • 7
  • 29
  • 43
0

How large? I believe that if the file is too (hundreds of megabytes), perhaps use a service dedicated to this (S3/DropBox, etc)?

Dimitrios Mistriotis
  • 2,626
  • 3
  • 28
  • 45
0

Perl is an interpreted server-side language that runs on top of the web server, just like PHP, you switching languages is unlikely to change anything.

Is there a better way? Since you don't say you what issues are, we can't suggest a way to fix them ;-)

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
  • You're mistaken as mod_perl does not run on top, but *in* the Web server. It has the appropriate hooks to e.g. [reject large uploads before they finish arriving](http://stackoverflow.com/q/4558067#4558357), something which PHP never could and still cannot do. – daxim Apr 20 '11 at 11:33
  • 1
    @daxin - Does my question deserve a downvote because you don't like my metaphor to describe the role server side langs interpreters play? It's like claming that the download and upload terms are plain wrong because computers can be installed in a vertical slot. – Álvaro González Apr 20 '11 at 11:59