Page 1 of 1

Cheating MAX_UPLOAD_SIZE

Posted: Wed Dec 27, 2006 3:40 pm
by shiznatix
Ok I want people to have the ability to upload large files to my server. Right now of course we are restricted to 30 seconds execution and 2 megs upload. Well this is poopy!

I was wondering if there was a way to use some AJAX to kind of split a file up and send it chunk by chunk and reassemble it on the server, kinda like a rar style thing. This could be done slowly if needed to keep the 30 seconds time and even work around the 2 megs limit by breaking it into 2 meg chunks. But, is this even possible? Where would I start? Any other ideas for this, maybe using things like the ftp functions or whatever? All files that will be uploaded are trusted 100% no questions asked.

Posted: Wed Dec 27, 2006 3:46 pm
by Oren
Can't you use an htaccess file to change the needed values or contact your host to do so?

P.S You really want to upload files bigger than 2MB using your browser?

Posted: Wed Dec 27, 2006 3:54 pm
by Ambush Commander
As far as I can see, JavaScript offers no facilities for the memory-expensive chunking procedure you describe. Heck, I don't think it would even be able to read the file.

In this case, I would strongly recommend setting FTP accounts for these people into some temporary directory. Upload via FTP, then do your stuff. SourceForge has a mechanism like this for uploading new releases (although, admittedly, it's more complicated than it should be).

Posted: Wed Dec 27, 2006 3:55 pm
by timvw
I'd probably look for a Java applet.. And then look for some zip (or other archive) library to do the splittings... And start uploading...

(eg: http://www.javazoom.net/applets/jclient ... _http.html)

Posted: Wed Dec 27, 2006 4:19 pm
by feyd
What about a write-only FTP account?

Posted: Wed Dec 27, 2006 4:43 pm
by kingconnections
Not sure about the upload limit, but I have used this for long scripts that blow past the 30 sec run time.

set_time_limit -- Limits the maximum execution time
http://us2.php.net/manual/en/function.s ... -limit.php

Posted: Wed Dec 27, 2006 5:11 pm
by feyd
Unfortunately, maximum execution time doesn't affect PHP's processing during the upload itself, which is set by a different directive. Specifically, max_input_time.

Posted: Wed Dec 27, 2006 5:31 pm
by shiznatix
timvw wrote:I'd probably look for a Java applet.. And then look for some zip (or other archive) library to do the splittings... And start uploading...

(eg: http://www.javazoom.net/applets/jclient ... _http.html)
this sounds great. let me be sure im understanding, i could write a java applet that could upload any size file, even without breaking it up right? If so, would there be a way to limits its bandwidth usage?

Posted: Wed Dec 27, 2006 5:50 pm
by timvw
if your (php) script has a 2mb limit... you will have to do it in 2mb chunks... no way to get round that limitation... (apart from removing/altering the limitation itself)

Posted: Wed Dec 27, 2006 10:21 pm
by shiznatix
timvw wrote:if your (php) script has a 2mb limit... you will have to do it in 2mb chunks... no way to get round that limitation... (apart from removing/altering the limitation itself)
so java can only use some php script to upload the file? so maybe i could use java to get the file and break it up then upload the chunk to the server through php? i dont know much about java so before i start learning it to do this i would like to make sure its possible first.