views:

860

answers:

5

I have a web application that accepts file uploads of up to 4 MB. The server side script is PHP and web server is NGINX. Many users have requested to increase this limit drastically to allow upload of video etc.

However there seems to be no easy solution for this problem with PHP. First, on the client side I am looking for something that would allow me to chunk files during transfer. SWFUpload does not seem to do that. I guess I can stream uploads using Java FX (http://blogs.sun.com/rakeshmenonp/entry/javafx_upload_file ) but I can not find any equivalent of request.getInputStream in PHP.

Increasing browser client_post limits or php.ini upload or max_execution times is not really a solution for really large files (~ 1GB) because maybe the browser will time out and think of all those blobs stored in memory.

is there any way to solve this problem using PHP on server side? I would appreciate your replies.

A: 

You can definitely write a web app that will accept a block of data (even via a POST) then append that block of data to a file. It seems to me that you need some kind of client side app that will take a file and break it up into chunks, then send it to your web service one chunk at a time. However, it seems a lot easier to create an sftp dir, and let clients just sftp up files using some pre-existing client app.

Zak
http://code.google.com/p/gigaupload/
rjha94
A: 

I think create sockets between servers and client and sent data in chunks! .. low level programming seems to be the solution .. may not be the bets

+1  A: 

"but I can not find any equivalent of request.getInputStream in PHP. "

fopen('php://input'); perhaps?

Bart van Heukelom
No php://input for multipart form data
rjha94
+1  A: 

How about using a java applet for the uploading and PHP for processing..

You can find an example here for Jupload: http://sourceforge.net/apps/mediawiki/jupload/index.php?title=PHP_Example

Chris
Thanks for the link. That should be possible, I am trying with Java FX right now. JUpload screenshot looks from about 10 years back ;o)
rjha94
Haha am not sure man :) but the PHP code is pretty recent.. (few days ago last update) you can see how they do the chunking.. http://jupload.svn.sourceforge.net/viewvc/jupload/trunk/wwwroot/samples.PHP/jupload.php?view=markup
Chris
+1  A: 

I have created a JavaFX client to send large files in chunks of max post size (I am using 2 MB) and a PHP receiver script to assemble the chunks into original file. I am releasing the code under apache license here : http://code.google.com/p/gigaupload/ Feel free to use/modify/distribute.

rjha94
If this is what solved your problem then don't hesitate and mark it as answer ;-)
MartyIX