tags:

views:

97

answers:

3

I created an simple web interface to allow various users to upload files. I set the upload limit to 100mb but now it turns out that the client occasionally wants to upload files 500mb+.

I know what to alter the php configuration to change the upload limit but I was wondering if there are any serious disadvantages to uploading files of this size via php?

Obviously ftp would be preferable but if possible i'd rather not have two different methods of uploading files.

Thanks

+3  A: 

Firstly FTP is never preferable. To anything.

I assume you mean that you transferring the files via HTTP. While not quite as bad as FTP, its not a good idea if you can find another of solving the problem. HTTP (and hence the component programs) are optimized around transferring relatively small files around the internet.

While the protocol supports server to client range requests, it does not allow for the reverse operation. Even if the software at either end were unaffected by the volume, the more data you are pushing across the greater the interval during which you could lose the connection. But the biggest problem is that caveat in the last sentence.

symcbean
A: 

Regardless of the server technology you use (PHP or something else) it's never a good idea to push that big file in one sweep in synchronous mode.

There are lots of plugins for any technology/framework that will do asynchronous upload for you.

Besides the connection timing out, there is one more disadvantage in that file uploading consumes the web server memory. You don't normally want that.

Developer Art
By "memory", I hope you mean "disk space".
Artefacto
I mean RAM. But I'm not sure about PHP in particular and how it processes uploads.
Developer Art
A: 

PHP will handle as many and as large a file as you'll allow it. But consider that it's basically impossible to resume an aborted upload in PHP, as scripts are not fired up until AFTER the upload is completed. The larger the file gets, the larger the chance of a network glitch killing the upload and wasting a good chunk of time and bandwidth. As well, without extra work with APC, or using something like uploadify, there's no progress report and users are left staring at a browser showing no visible signs of actual work except the throbber chugging away.

Marc B