Re: Re: File Upload - post_max_size and upload_max_filesize in GBs
| From: | Sukhwinder Singh | Date: | Fri, 08 Jun 2007 19:43:59 +0000 |
| Subject: | Re: Re: File Upload - post_max_size and upload_max_filesize in GBs | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256384@lists.php.net to get a copy of this message | ||
----- Original Message ----- From: "Richard Lynch" <ceo@l-i-e.com>
To: "Sukhwinder Singh" <ssruprai@hotmail.com>
Cc: "Jim Moseby" <jmoseby@nrbindustries.com>; <php-general@lists.php.net>; "Stut" <stuttle@gmail.com>
Sent: Friday, June 08, 2007 11:32 PM
Subject: Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs
On Fri, June 8, 2007 8:58 am, Sukhwinder Singh wrote:Actually only admin will upload files and that to locally. That is why I am not worried about wasting 15 minutes to upload it through browser.I had a look at that. My problem is that along with uploading file I also have to post some other information as well. File names are randomly generated. Jupload seems to do the work other than that POST problem. Client is asking for web based solution. I cannot ask him to do ftp.You are never going to be happy with such large uploads over HTTP, imho. Nor are your users, for several reasons: No way to continue aborted/failed upload, unlike FTP Browser timeout completely outside your control Too many users will think they have to sit and wait to finish
Only if I was a C programmer :-). Not even java programmer anymore.PHP's handling of uploaded files is confusing. I have added logging to the script to which jupload posts. Logging suggests that php file is only accessed after file is completely uploaded by jupload. I also checked apache access logs. Entry in apache log appears only after file is completely uploaded.Sort of... You'd have to read Apache and PHP sources to see how it all works for sure, but...
Yes, that is what is happening.Another thing that came up with this jupload is that as soon as I hit upload button, a file named phpxx.tmp (xx is any number) is created in temporary directory and its size starts growing as upload happens.It's entirely possible that Apache and PHP conspire to handle the upload, and do things about the upload, but you won't have any access in php script to it, most likely, until it's all finished.
That said, check out Rasmus' recent patch to PHP which allows for an upload progress meter -- It's entirely possible you could glean something useful from that...I have my own ajax script. which uses php 5.2 to monitor progress. The problem is php's limit of around 1.99 GB. You have missed few posts. http://www.nabble.com/RE:-File-Upload---post_max_size-and-upload_max_filesize-in--GBs-t3884697.html In my first email I had specified that when I set php limit to 4G it starts complaining about maximum post length (as it becomes negative). It seems to store values in integer or something. Also even apache 2.0 complains about invalid content length when I try to post 4 gb file. I have checked logs. May be apache 2.2 solves this problem.
Not file system. I have tried on linux, windows (NTFS). As I explain above about negative numbers of post_max_size.If applet doesn't post to php even at start then how come the temporary file is named phpxx.tmp.It's posting to Apache which is talking to PHP to handle the upload, but it's a "team" process, and your PHP script has zero access until it's done.I tried to upload file on internet using jupload and it seems to me script is timing out even when I have specified 1 hour as timeout. set_time_limit(216000);You have to define "timing out" more clearly... Often-times, a browser will give up, even if the upload is proceeding normally. We cannot fix broken web browsers. No matter how much we'd like to. :-)137 MB upload seemed to time out. and the set_time_limit doesn't seem to have any affect.Then the timeout isn't coming from PHP, but from another source. Apache may be timing out, a buggy browser may be timing out, the Internet connection may simply not be stable enough for a sustained transfer...Now the even if I accept php's 1.99 GB limit. What to do about this timeout?A 1.99 G limit is probably file-system based...
Right.Do I have to set it in php.ini? Why woudn't it work through the above function?You cannot affect file upload in a PHP script, because the upload occurs (or fails to occur) long before your PHP script begins to run -- You can only do it in php.ini or in .htaccessStut is suggesting it has to be custom made as this kind of solution doesn't seem to already exit. A solution where some applet etc. only passes that information to php which is needed to move the file and update the database.Perhaps you should look at Flikr's application that they implemented for this purpose, or read "Building Scalable Web Sites" by Cal Henderson (of Flikr)
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?