Cheating MAX_UPLOAD_SIZE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Cheating MAX_UPLOAD_SIZE

Post 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.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post 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?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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).
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What about a write-only FTP account?
kingconnections
Forum Contributor
Posts: 137
Joined: Thu Jul 14, 2005 4:28 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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)
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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.
Post Reply