Forum Moderators: coopster

Message Too Old, No Replies

PHP Large File Upload Times-Out

using HTTP to transfer over 200 megabyte file

         

Parlays

9:03 pm on Jan 14, 2008 (gmt 0)

10+ Year Member



I have set up a file upload HTML form for people to upload large files (200-300 megabyte) to my server. These files are quite large, 200 - 300 megabytes. They are being transferred over HTTP to a PHP script to handle the file.

I have set up the PHP.INI settings to handle large file uploads and max execution time.

Everything works perfect with files under the size of 80 megabytes but once it starts to upload 200 megabyte files, when it gets to over 100 megabytes of uploading, at one point the file upload amount starts flickering and repeating the next megabyte to be uploaded. For instance it says 102 megabytes uploaded and then it goes to 103 megabytes and then it goes back to 102 and then goes to 103, and so on...

I've been told that HTTP cannot handle uploads this size, but I didn't know if that was true. I am considering using PHP FTP functions but I believe they initially are sent over HTTP and then PHP FTP is used to just move the file to the right directory. Any insight on this issue is much appreciated.

venelin13

9:14 pm on Jan 14, 2008 (gmt 0)

10+ Year Member



HTTP was not designed to transfer such data amounts. You should use the FTP functions. With the PHP's ftp functions, the files are trnasfered over the FTP protocol, not over the HTTP protocol.

Parlays

2:23 am on Jan 15, 2008 (gmt 0)

10+ Year Member



So if I set up an HTML form that is handled by PHP FTP functions it will be transferred by FTP to the temp directory?

But will the initial request go to the handling PHP FTP page by HTTP, because the URL still says HTTP on the HTML form page?

roshanbh

5:40 am on Jan 15, 2008 (gmt 0)

10+ Year Member



Try this one out...create a .htaccess file in root folder and place the following code in that file

php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 800
php_value max_input_time 800

thecoalman

6:12 am on Jan 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Instead of setting the max_excecution_time in the php.ini I've been using set_time_limit in the script itself. My reasoning is you are keeping a reasonable limit for other scripts that don't need the excessive time.

Parlays

1:40 am on Jan 16, 2008 (gmt 0)

10+ Year Member



Tried that, thanks for the recommendations.

The problem occurs after about 20 minutes there becomes a problem writing the file to the server, it gets stuck at a certain point and cannot write anymore, it goes to say 97 megabytes and then goes back down to 96 megabytes and then goes to 97 megabytes and then goes back down to 96 megabytes and back and forth... then it goes to the error page.

I've been trying to figure out what has been taking place for a long time! Any help is much appreciated.

leeburstroghm

2:32 am on May 20, 2008 (gmt 0)

10+ Year Member



Hey, I have the exact same issue.. I need to upload about 850 mb or so, I do some stuff after the file is uploaded.. so if the ftp functions will do that.. great.. I am able to upload and the script seems to finish though the browser displays the download dialog on files over about 50MB.. even 200mb files get uploaded and the script finishes, moves the uploaded file, renames it and does all that, the page just does not display, I get the download dialog.. I will try FTP functions tomorrow and see if I am able to get that to work.. unless there is another solution to use http forms upload.. ? I ahve max input, max execution , max_post and max files size all set to very high.. even my max memmry usage, nothing seems to matter. any help is greatly appreciated.