Knowledgebase

Large file uploads with POST multipart/form-data

Posted by daveime, 01-11-2013, 06:05 PM
I'm having a problem with uploading large files using POST multipart/form-data to a Linux Hosting Server hosted on GoDaddy. Specifically, the upload times out after 60 seconds, and I can't even seem to see the partially uploaded files on the PHP /tmp directory. I've already managed to customize the php5.ini file, and the following settings are already in place and working when I test with phpinfo() :- max_execution_time = 0 memory_limit = -1 upload_max_filesize = 32M post_max_size = 32M max_input_time = 1800 And yet the uploads are still timing out after 60 seconds. I figure it's an Apache hardcoded setting that's either limiting the upload size, or limiting the thread execution time - either way, as anyone who's been on GoDaddy will know, it's impossible to change httpd.conf, nor override it using .htaccess (which just gives 500 error when you use Apache directives). Has anyone had experience with GoDaddy Hosting, or know a way around this ? Their tech support (sic) merely repeats what I told them in the question, and when I posted on their forums, the moderator deleted the post altogether. Thanks in advance

Posted by Wildex999, 01-12-2013, 10:40 AM
From my own experience with shared hosting, any kind of long lasting connection/work is a no-no. So your options are either to move to a shared host that actually allow long file uploads, go to VPS/Dedicated hosting and take control of it yourself, or you can try to upload the file in parts. Since javascript assumes all users are idiots, and thus put a lot of restrictions that are near impossible to bypass, there are really no standard way to access local files to upload them in parts trough something like AJAX. Lately though there are quite a few browser specific methods of reading local files, and HTML5 has a way if I'm not mistaken. You could try looking into that, and the upload a chosen file in 512KB blocks or something like that, and then put it together in PHP over time. Good Luck =)

Posted by daveime, 01-14-2013, 12:16 AM
Thanks for the advice, however GoDaddy finally came through and resolved the issue for me. In case anyone is wondering, the default setup for PHP on GoDaddy is using FastCGI, and this seems to place additional restrictions / override the settings that you have made in the php.ini with regards to timeouts and upload limits etc. So the solution is, go into the GoDaddy Control Panel, select settings, and reconfigure the file extensions for php4, php5 and php to use the PHP version WITHOUT FastCGI. Unfortunately, they don't offer the option for PHP 5.3 without FastCGI, so you have to effectively downgrade to PHP 5.2, which may mean some slight rework in your scripts themselves. But the uploads are now working fine.

Posted by TwineDev, 01-14-2013, 07:16 AM
It is more specific to a case of restrictions are in place so that a hacked script on a site cannot just pick whatever file it want's to grab. Think about how much fun that would be if any site could on it's own just grab whatever file it wanted from your computer and upload it to a web server...

Posted by Wildex999, 01-14-2013, 11:54 AM
Yeah, but they could have just made it like: Script x request access to do y, because *insert custom description here*, will you allow this? [Yes/No]. You know, like every other program you CHOOSE to run on your computer?

Posted by TwineDev, 01-14-2013, 03:49 PM
And as someone who maintains many other people's computers, do you know how many times I have had to clean out peoples computers from things getting installed that they, when asked about installing it, they say they clicked on a link on website, and "Yeah something came up, I didn't know what it meant so I clicked to let it continue" Sad but true... (shaking head thinking of one friend in certain LOL) If there was only a way to require people to pass a test to be online like you do with driving a car... (yeah, I know many people drive without being legally licensed, just the concept I like)



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
e3 Servers problems (Views: 567)


Language:

Client Login

Email

Password

Remember Me

Search