[PHP] large file uploads
Hello! Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. Thanks, Arthur Looking for a job!? Use the smart search engine!! Find a Job from Millions WorldWide... http://search.jobsgrabber.com
RE: [PHP] large file uploads
[snip] Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. [/snip] http://us3.php.net/features.file-upload The manual is your fried, read it, love it, use it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Arthur Radulescu wrote: Hello! Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. http://www.radinks.com/upload/config.php will tell you all the parameters that you need to change. http://www.raditha.com/megaupload/upload.php will tell you how to get past the upload restrictions if you don't have access to the php.ini file. -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Jay Blanchard wrote: [snip] Does any one now how I can handle large file uploads (around 10-20 MB) with PHP. I need this functionality into an intranet but I cannot figure out what I must configure to handle this. [/snip] http://us3.php.net/features.file-upload The manual is your fried, read it, love it, use it. And it is served with a heaping serving of home fries, and covered with a delicious white country gravy. (Low calorie fried manuals available upon request). Sorry...couldn't resist. ;) -- *** * _ __ __ __ _ * John Nichel * * | |/ /___ __ \ \/ /__ _ _| |__ ___ __ ___ _ __ * 716.856.9675 * * | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ ' \ * 737 Main St. * * |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150 * * |___/ * Buffalo, NY * * http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] large file uploads
[snip] ...fried... And it is served with a heaping serving of home fries, and covered with a delicious white country gravy. (Low calorie fried manuals available upon request). Sorry...couldn't resist. ;) [/snip] Thanks, I needed that! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. Arthur - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: John Nichel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 5:05 PM Subject: RE: [PHP] large file uploads [snip] ...fried... And it is served with a heaping serving of home fries, and covered with a delicious white country gravy. (Low calorie fried manuals available upon request). Sorry...couldn't resist. ;) [/snip] Thanks, I needed that! -- 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
RE: [PHP] large file uploads
[snip] I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. [/snip] Did you restart your web server? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Yes I restarted the server and then the computer... No success... The page timeouts after a while but the file does not gets uploaded Arthur Looking for a job!? Use the smart search engine!! Find a Job from Millions WorldWide... http://search.jobsgrabber.com - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Arthur Radulescu [EMAIL PROTECTED]; John Nichel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 5:12 PM Subject: RE: [PHP] large file uploads [snip] I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. [/snip] Did you restart your web server? !DSPAM:40740ae1152691248315722! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] large file uploads
[snip] Yes I restarted the server and then the computer... No success... The page timeouts after a while but the file does not gets uploaded [/snip] Please trim your replies, and please do not top post. Can we see your upload code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
The code is below (pieces of it). The folders have write permissions. It works just fine with smaller files but nothing happens with larger files if(!is_uploaded_file($_FILES['file']['tmp_name'])){ $ERR['file']=1; } if(!sizeof($ERR)){ $try=copy_file($_FILES['file']['tmp_name'], $TO_FILE); // copy_file makes the upload using copy or move_uploaded_file if($try==copy_err){ echo copy_err; } else{ echo copy_success; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
On Wednesday 07 April 2004 22:14, Arthur Radulescu wrote: The code is below (pieces of it). The folders have write permissions. It works just fine with smaller files but nothing happens with larger files 1) What are your upload-related settings in php.ini? 2) Have you enabled FULL error reporting? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Uniforms only come in two sizes, too small and too large -- Murphy's Bush Fire Brigade Laws n6 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] large file uploads
Arthur Radulescu wrote: I have forgot to mention that I have tried this and modified the php.ini on a windows system but had no success. There is no error but the file does not get uploaded either. The error message is in your log file. Arthur -- Raditha Dissanayake. - http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Large File Uploads
I'm having some trouble with a file upload script that runs over SSL. It seems that the file is kept in memory while being uploaded and then flushed to disk as a temp file. This is fine, but when you are dealing with large files, you can run out of memory. Apache (or PHP?) also doesn't seem to recover from large file uploads very well. After uploading a few large files (30MB to 300MB), the httpsd process continues to use ~400MB. If I let it go long enough, with the machine swapping, the script will eventually come back but it acts like there was no file uploaded. Does anyone have suggestions? I need for my users to have the ability to upload large files over a SSL connection using common browsers. I can't make them run applets or use an insecure method for doing these transfers. -- Ben Sinclair [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Large file uploads timeout - ouch!
I'm designing a simple content management system with PHP, and it is going great, except... I do seem to have one problem - I'm trying to use PHP's copy function to upload files through a web browser. It works fine on small files, but times out on large ones, like a 20 MB file I'm sending. I'm on a 1Mbps DSL connection, and routinely download 600MB iso images with no problem, and seem to be having no connection problems on this end. My client is also getting timeouts on large files, and they're on a different network. The web server is running Debian Linux kernel 2.2.19; Apache/1.3.9; PHP 4.0.6 at a web hosting company. I checked the PHP manual, it said that the default maximum file upload size is 2MB. I used phpinfo() to show the server settings, and it reports that it is: upload_max_filesize=2M post_max_size=8M max_execution_time=30 which is the global file upload maximum and POST maximum and execution limit. I changed /cgi-bin/php.ini to include the lines upload_max_filesize=200M post_max_size=200M max_execution_time=2400 memory_limit=120M and saved it. I tried my upload again, but it still times out. Does Apache need to be restarted for the change to take effect? I ran phpinfo() again, and it shows upload_max_filesize=200M post_max_size=200M max_execution_time=2400 so it looks like it took the change to php.ini. I successfully uploaded a 1.8MB file, a 2.2MB file, a 4.1MB file, a 5.4MB file, a 6.1MB file, a 6.9MB file, and a 7.05MB file, but a 7.248MB file and a 7.6MB file timed out like the larger one. I'm doing the upload from IE 6.0 on Windows 2000 (running on my Linux box with VMware). I got the same results on Mozilla 0.9.6 on Mandrake Linux 8.0. I've read that PHP file uploads are done in RAM, so perhaps that is part of the problem? Unfortunately, my client plans to upload ~90MB files this way, and I'd like to leave PHP file upload as the only method needed. Here's part of the page using the upload/rename/delete script. It works flawlessly on smaller files. The only timeout (that I *know of!*) that I don't know how to change is the Apache timeout of 300 seconds. It appears that it is indeed timing out after 300 seconds (five minutes). It shows as HTTP_KEEP_ALIVE = 300 in phpinfo(). All of this is done on a virtual server at a web host, so I don't have access to the httpd.conf for Apache, although they *might* change it if I know what to ask them... ;-) TIA Fred /* New to Linux (nine months) and PHP (2 weeks) but loving it! */ == TABLE BORDER=0 WIDTH=100% CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER ?php //print(\$Clientcode = $Clientcode, \$Usercode = $Usercode\n); /* This file lists all the information for files in a directory and allows the user to delete, upload and rename files. */ if ($Upload) { // Handle file uploads. print (TRTD COLSPAN=4 ALIGN=CENTERUploaded file name: $File_name/TD/TR\n); print (TRTD COLSPAN=4 ALIGN=CENTERUploaded file size: $File_size/TD/TR\n); if (copy ($File, documents/$Folder/$File_name)) { print (TRTD COLSPAN=4 ALIGN=CENTERYour file, $File_name, was successfully uploaded!/TD/TR\n); } else { print (TRTD COLSPAN=4 ALIGN=CENTERYour file, $File_name, could not be copied./TD/TR\n); } unlink ($File); print (TRTD COLSPAN=4 ALIGN=CENTERnbsp;/TD/TR\n); } if ($Delete) { // Handle file deletions. for ($i = 0; $i count ($Delete); $i++) { if ( unlink (documents/$Folder/$Delete[$i]) ) { print (TRTD COLSPAN=4 ALIGN=CENTERYour file, $Delete[$i], was successfully deleted!/TD/TR\n); } else { print (TRTD COLSPAN=4 ALIGN=CENTERYour file, $Delete[$i], could not be deleted./TD/TR\n); } } print (TRTD COLSPAN=4 ALIGN=CENTERnbsp;/TD/TR\n); } if ($Rename) { // Handle file renaming. for ($n = 0; $n count ($Rename); $n++) { $OldFilename = $Rename[$n]; $Old = documents/$Folder/$OldFilename; $New = documents/$Folder/$NewName[$OldFilename]; if ( rename ($Old, $New) ) { print (TRTD COLSPAN=4 ALIGN=CENTERYour file, $Rename[$n], was successfully renamed!/TD/TR\n); } else { print (TRTD COLSPAN=4 ALIGN=CENTERYour file, $Rename[$n], could not be renamed./TD/TR\n); } } print (TRTD COLSPAN=4 ALIGN=CENTERnbsp;/TD/TR\n); } // Start the form. $HTTP_KEEP_ALIVE = 2400; print (FORM METHOD=POST ENCTYPE=\multipart/form-data\ ACTION=\files.php\\n); print (input type=\hidden\ name=\MAX_FILE_SIZE\ value=\2\\n); // max file size set to 200 MB print (TRTDh2Folder bi$Folder/i/b:/h2/TD/TR\n); print (TRTDBFile Name/B/TDTDBFile Size/B/TDTDBDelete/B/TDTDBRename/B (Enter the New Name in the Box)/TD/TR\n); // Read the files from the
Re: [PHP] Large file uploads timeout - ouch!
Sorry, no can do, I can't stand SPAM, and I don't need any more email. Just reply to the newsgroup. I can read it there, and it may help others - that is what newsgroups are for!;-) On Wed, 05 Dec 2001 03:57:05 -0500, Mirek Novak wrote: fix your email to receive answers FIRST! M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
so, RTFM HTH M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
Now that you've helped me, go and help someone else...please. And yes, I did read the manual and several books on PHP already. Have you? On Wed, 05 Dec 2001 04:09:00 -0500, Mirek Novak wrote: so, RTFM HTH M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
Now that you've helped me, go and help someone else...please. And yes, I did read the manual and several books on PHP already. Have you? On Wed, 05 Dec 2001 04:09:00 -0500, Mirek Novak wrote: so, RTFM HTH M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
Now that you've helped me, go and help someone else...please. And yes, I did read the manual and several books on PHP already. Have you? On Wed, 05 Dec 2001 04:09:00 -0500, Mirek Novak wrote: so, RTFM HTH M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
fred wrote: Now that you've helped me, go and help someone else...please. And yes, I did read the manual and several books on PHP already. Have you? and have you seen function set_time_limit() while u were reading the manual?. BTW - this was on the list many times and as u were noting '... that is what are the newsgroupf for' instead of this they are for to be searched TOO! Just don't be lazy! HTH M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
Sorry, I don't know where you are coming from. You don't know me, and are assuming things that just aren't true, calling me lazy? Thank you for the info. Now to answer your accusation... I searched the newsgroups all day and never found that function, and scoured php.net. I searched the PHP bugs forum. Sorry I missed that one function in the 1,259 page PHP manual. I did find the other six items I listed, which stumped a lot of other people, 100's of them in fact, for many reasons. I tested and debugged that script. I posted it for the benefit of others, as well as to give all info about my problem. So, according to you, not only am I lazy, but I guess all the others with the file upload problem must be lazy too. Is that work *your* definition of lazy? It isn't mine. If you want to help people, help them, otherwise, find something else to do. I saw your post here in May asking for help. I guess you're glad someone helped *you* when you asked here, hmm? On Wed, 05 Dec 2001 04:19:51 -0500, Mirek Novak wrote: fred wrote: Now that you've helped me, go and help someone else...please. And yes, I did read the manual and several books on PHP already. Have you? and have you seen function set_time_limit() while u were reading the manual?. BTW - this was on the list many times and as u were noting '... that is what are the newsgroupf for' instead of this they are for to be searched TOO! Just don't be lazy! HTH M.N. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
After all of this, and you give me the wrong answer. If you read the PHP manual, you will see that set_time_limit falls defaults to max_execution_time, which I already have set to 2400, so your answer is irrelevant. That is not controlling HTTP_KEEP_ALIVE, which is defaulting to 300 seconds somewhere - probably httpd.conf. Now who is lazy? On Wed, 05 Dec 2001 04:25:15 -0500, Fred wrote: Sorry, I don't know where you are coming from. You don't know me, and are assuming things that just aren't true, calling me lazy? Thank you for the info. Now to answer your accusation... I searched the newsgroups all day and never found that function, and scoured php.net. I searched the PHP bugs forum. Sorry I missed that one function in the 1,259 page PHP manual. I did find the other six items I listed, which stumped a lot of other people, 100's of them in fact, for many reasons. I tested and debugged that script. I posted it for the benefit of others, as well as to give all info about my problem. So, according to you, not only am I lazy, but I guess all the others with the file upload problem must be lazy too. Is that work *your* definition of lazy? It isn't mine. If you want to help people, help them, otherwise, find something else to do. I saw your post here in May asking for help. I guess you're glad someone helped *you* when you asked here, hmm? On Wed, 05 Dec 2001 04:19:51 -0500, Mirek Novak wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
fred wrote: After all of this, and you give me the wrong answer. If you read the PHP manual, you will see that set_time_limit falls defaults to max_execution_time, which I already have set to 2400, so your answer is irrelevant. That is not controlling HTTP_KEEP_ALIVE, which is defaulting to 300 seconds somewhere - probably httpd.conf. Now who is lazy? it was ONE question to google.com: +large file uploads +php results in http://www.phpbuilder.com/forum/read.php3?num=2id=137901loc=0thread=118340 -X- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
Did you read my post? I did all of that *before* I posted my question. Anyone else have a suggestion? TIA Fred On Wed, 05 Dec 2001 05:16:38 -0500, Mirek Novak wrote: fred wrote: After all of this, and you give me the wrong answer. If you read the PHP manual, you will see that set_time_limit falls defaults to max_execution_time, which I already have set to 2400, so your answer is irrelevant. That is not controlling HTTP_KEEP_ALIVE, which is defaulting to 300 seconds somewhere - probably httpd.conf. Now who is lazy? it was ONE question to google.com: +large file uploads +php results in http://www.phpbuilder.com/forum/read.php3?num=2id=137901loc=0thread=118340 -X- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Large file uploads timeout - ouch!
I believe that you must normally restart apache for php.ini changes to take affect. The fact that the changes show up in phpinfo() may or may not indicate that the changes are actually in effect. If your ISP has not restarted apache, you may want to ask them to do so in order to save yourself a lot of head aches. If that is not the problem, then read on. In your initial request you mentioned that you suspected that HTTP_KEEP_ALIVE was suspect and you asked for information on how to change that environmental variable. The HTTP_KEEP_ALIVE setting in apache controls how long the server wait for a second request on a single connection before closing the connection. This setting is typically set to something like 15 seconds and would not affect the behavior of your script. If you look at your phpinfo() under the apache heading you will notice a row called Timeouts. There are two settings listed here. The first is Connection which is typically 300 and the second is keep-alive which is typically 15. If your ISP has 300 set for keep-alive then you may want to advise them to change it because it leaves unused connections open for 5 minutes clogging up memory and child processes. I suspect, however, that it is the Connections setting that is set to 300. If that is the case then your ISP can open httpd.conf and edit the line that says: timeout 300 and change it to a larger number. They could also change this setting to 0 which means there is no timeout. That could also cause problems, however, because abandoned connections could tie up system resources. This may solve your problem, but I dount it. This timeout setting controls the amount of time that apache waits for three things: 1. The total amount of time it takes to receive a GET request. 2. The amount of time between receipt of TCP packets on a POST or PUT request. 3. The amount of time between ACKs on transmissions of TCP packets in responses. In other words, as long as data is flowing apache will not timeout. I have a script that automatically generates 20MB word files and apache has no problem keeping the connection alive for the 30 minutes it takes to download the data over a slow connection despite the fact that Timeout is set to 300. If your php.ini settings are indeed correct, it may well be that apache is timing out for some reason, but if that is the case it is caused by one of the three reasons above. The first reason is not the issue because you are not using the GET method. The third reason is not the issue because ACKs are sent by the receiving host rather than the sender, so apache is not expecting ACKs. That leaves only the second reason: The amount of time between receipt of TCP packets on a POST or PUT request. If this is the problem, it would indicate that your browser has stopped sending packets for more than 300 seconds. If you have not done so, you may wish to monitor the data flow to determine if this is the case. If so, then your browser is timing out for some reason unrelated to apache or php and you may want to try another browser. If this is not the problem then you have me stumped. Fred Fred [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Did you read my post? I did all of that *before* I posted my question. Anyone else have a suggestion? TIA Fred On Wed, 05 Dec 2001 05:16:38 -0500, Mirek Novak wrote: fred wrote: After all of this, and you give me the wrong answer. If you read the PHP manual, you will see that set_time_limit falls defaults to max_execution_time, which I already have set to 2400, so your answer is irrelevant. That is not controlling HTTP_KEEP_ALIVE, which is defaulting to 300 seconds somewhere - probably httpd.conf. Now who is lazy? it was ONE question to google.com: +large file uploads +php results in http://www.phpbuilder.com/forum/read.php3?num=2id=137901loc=0thread=11834 0 -X- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Large File Uploads, max file sizes and timeouts
Hey all, Two related questions. If I remember correctly this has been beaten to death before on the list, but here I am having issues with it, and ending up at somewhat of a loss still. I've built a media management system for a video company. It is built to handle large data assets, such as extended full size video files. As such, I've set the max upload file size in the php.ini file to around 3GB. I'm running into a bug where the system seems to think that the file upload is done at about 140MB on a 300MB file. Everything seems to close out fine within the system, acting like the file was originally 140MB and it uploaded just fine in the system. But it really is a 300MB file, I promise. Does this ring any bells with anyone? This is all over a local network, so I'm not inclined to believe that it is network lag triggering the connection to close... Second, can anyone point me in the right direction within the documentation to tell how to override the php.ini fiole on a particular page to allow a larger file upload size and a longer session timeout? Thanks all, Wes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]