Re: Re: File Upload - post_max_size and upload_max_filesize in GBs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think you need to read up on how an HTTP POST request works when it's handled by PHP because some of what you've written there indicates that you don't quite have it. When you hit the upload button the browser makes a connection to the server and the PHP engine gets invoked to handle the request. The engine then reads the entire HTTP request, including the file data that is being uploaded. That temporary file is created by the PHP engine to temporarily store the incoming data. Only when the entire request has been read does the PHP engine start running your PHP script.

Yes I didn't know. But I learned by actully experimenting with it and discussing on this mailing list.
It is not everyday that you have to deal with such issues.

Sites like these calim that you can use your web browser to upload 10 gb files. http://www.sendyourfiles.com/features/?web-mail
But clients forget that they are using some kind of plugins.

That's the PHP timeout kicking in. There is another setting in php.ini (I forget what it's called) that tells it how long it is allowed to wait for the request to be read, but looking at that error I'm not convinced that's what's causing that timeout.

I think what you wanted to write was max_input_time.

It's very difficult to tell without seeing your script.

My script does nothing more than get the file information, move it and update the database.

Looks like I have to post that php's upload limit of 1.99 gb to php internal mailing list.

Definitely worth doing, but don't be surprised if you get the same reaction.

Yes I expect the same response :-). "Don't upload 4 gb files over http"

Thank you very much Stut!

----- Original Message ----- From: "Stut" <stuttle@xxxxxxxxx>
To: "Sukhwinder Singh" <ssruprai@xxxxxxxxxxx>
Cc: "Jim Moseby" <JMoseby@xxxxxxxxxxxxxxxxx>; <php-general@xxxxxxxxxxxxx>
Sent: Friday, June 08, 2007 8:01 PM
Subject: Re: Re: File Upload - post_max_size and upload_max_filesize in GBs


Sukhwinder Singh wrote:
Stut, thank you very much for explaining things and trying to help.

That's no problem, it's what I'm here for (I knew there was a reason).

The applet *does* POST to PHP. However, it has the option to upload to an FTP server.... "the choice of using HTTP, HTTPS or FTP connections for your transfer" (from the website).

So it seems applet posts complete data to that php file handling script (rather php engine),*as soon as upload button is clicked*, rather than uploading first and then posting to php. That is the reason for name phpxx.tmp of temporary file.

As that seems to be the case; there is no real benefit in using applet (in case of http) other than that progress bar which is already supported by php 5.2

It also seems that php engine only hands over control to php file after the file is completely uploaded that is why my custom logging doesn't start as soon as upload starts. It only starts when file is already uploaded.

I think you need to read up on how an HTTP POST request works when it's handled by PHP because some of what you've written there indicates that you don't quite have it. When you hit the upload button the browser makes a connection to the server and the PHP engine gets invoked to handle the request.

The engine then reads the entire HTTP request, including the file data that is being uploaded. That temporary file is created by the PHP engine to temporarily store the incoming data. Only when the entire request has been read does the PHP engine start running your PHP script.

The timeout is likely coming from Apache. It has a limits similar to PHP.

Tested on two servers. Both cases it seems to fail if it takes more than 30 seconds.
I get an error:
[08-Jun-2007 20:15:06] PHP Fatal error: Maximum execution time of 30 seconds exceeded in ....\handle_upload.php on line 2

That's the PHP timeout kicking in. There is another setting in php.ini (I forget what it's called) that tells it how long it is allowed to wait for the request to be read, but looking at that error I'm not convinced that's what's causing that timeout. It's very difficult to tell without seeing your script.

If you don't mind me asking, what are people uploading? 4gig is a lot for a single file of any type except maybe DVD images. Is there no way the user can upload several (read lots) smaller files instead of one big one?

It is not people that are uploading things. It is admin, and admin is local to server. I won't want to try uploading 4 GB over internet. And yes these are dvd files. They are going to be uploaded for streaming. But along with uploading of files som other fields also have to be uploaded. Client is showing examples like http://www.attachmore.com/Whysubscribe.aspx which claim unlimited upload size. I assume they are using custom activex controls.

If you look at the screenshots on that site you will see that they install something on your machine that provides the upload capability. Look specifically at the screenshot that shows the user right-clicking on a file in Windows and selecting to upload it. That's not a "web-based" solution, and if your client is pointing to it as such then they don't really know what they've talking about (like most clients in my experience).

Looks like I have to post that php's upload limit of 1.99 gb to php internal mailing list.

Definitely worth doing, but don't be surprised if you get the same reaction.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux