[PHP] File Upload MultiPart
Hello, I have been looking how to upload big files more than 1GB , with php but it doesn't work well. I guess php POST multipart method is to memory consuming. Is there a way , like in the apache.commons to catch the stream and handle it ? I've looked at the rfc1867.c file implementation and it seems that this is where the memory goes really up. Is there a way we could change this ? Kind Regards Wim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload MultiPart
On Sun, Feb 24, 2013 at 1:07 PM, user@domain.invalid wrote: Hello, I have been looking how to upload big files more than 1GB , with php but it doesn't work well. I guess php POST multipart method is to memory consuming. Is there a way , like in the apache.commons to catch the stream and handle it ? I've looked at the rfc1867.c file implementation and it seems that this is where the memory goes really up. Is there a way we could change this ? Kind Regards Wim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Although loathe to respond to someone listed as user@domain.local... Maybe look at http://stackoverflow.com/questions/10961538/uploading-very-large-files-5gb-to-15gb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload in map drive with PHP
Hello everyone, I've a question. I'm using map drive for file upload but dos'nt work. How can i do file upload map drive with php? Best Regards.
[PHP] File Upload Problem
Hi gang: I wrote a simple script to upload image files from my desktop to a server -- the exact same code works on two servers, but fails on a third. I suspect there is something set different between the servers, but I can't find it. Oddly enough, I can upload image files directly to the database, but not to the file system. What could be wrong? What should I be looking for? Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload Problem
On Wed, Apr 6, 2011 at 1:10 PM, tedd t...@sperling.com wrote: Hi gang: I wrote a simple script to upload image files from my desktop to a server -- the exact same code works on two servers, but fails on a third. I suspect there is something set different between the servers, but I can't find it. Oddly enough, I can upload image files directly to the database, but not to the file system. What could be wrong? What should I be looking for? Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php check out the max post size -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload Problem
On Wed, Apr 6, 2011 at 13:10, tedd t...@sperling.com wrote: Hi gang: I wrote a simple script to upload image files from my desktop to a server -- the exact same code works on two servers, but fails on a third. I suspect there is something set different between the servers, but I can't find it. Oddly enough, I can upload image files directly to the database, but not to the file system. What could be wrong? What should I be looking for? Are file uploads enabled and is the size of the file less than the upload size limitation? Is the disk or partition to which the temporary files are being uploaded out of space, whereas the database - perhaps on a different physical disk or partition - still has sufficient free space? Are you sure the user as which the web server (presumably Apache) runs has permission to write to the temporary and target directory? Is the account near or at its disk quota? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file upload utility ?
Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload utility ?
On Mon, Feb 7, 2011 at 10:56, Frank Bonnet f.bon...@esiee.fr wrote: Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Sounds great. Good luck in your Google search. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload utility ?
On 02/07/2011 05:01 PM, Daniel Brown wrote: On Mon, Feb 7, 2011 at 10:56, Frank Bonnetf.bon...@esiee.fr wrote: Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Sounds great. Good luck in your Google search. I found nothing that's why I wrote this !!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload utility ?
Frank Bonnet f.bon...@esiee.fr wrote: On 02/07/2011 05:01 PM, Daniel Brown wrote: On Mon, Feb 7, 2011 at 10:56, Frank Bonnetf.bon...@esiee.fr wrote: Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Sounds great. Good luck in your Google search. I found nothing that's why I wrote this !!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try googling for the following bits: File upload form move_uploaded_file() file_get_contents() That will get you going, then if you have written a script and get stuck then you can ask us on specifics here. We don't write whole code for you. Thanks Ash http://www.ashleysheridan.co.uk -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload utility ?
On 2/7/2011 8:03 AM, Frank Bonnet wrote: On 02/07/2011 05:01 PM, Daniel Brown wrote: On Mon, Feb 7, 2011 at 10:56, Frank Bonnetf.bon...@esiee.fr wrote: Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Sounds great. Good luck in your Google search. I found nothing that's why I wrote this !!! Frank, Not sure what words you used, here was mine php file upload examples Those words resulted in these two at the top of the list http://www.tizag.com/phpT/fileupload.php http://www.w3schools.com/PHP/php_file_upload.asp I briefly read each of them and they are sufficient for what you are trying to do. All you have to do is tie in the email portion and that's that. So, again, to google, I typed these wonderful words of wisdom. php email example The first result was this http://www.w3schools.com/PHP/php_mail.asp This will get you a very simple email script working. Personally, I would not do it this way, but since you mention that this will be all internal, it will probably do just fine. If you want a little more control over the email or plan to use this to send email to outside recipients, I would recommend doing it differently. phpmailer Download that package, then follow its tutorials on how to set it up and send emails. phpmailer examples The first result is this http://phpmailer.worxware.com/index.php?pg=examples It has a variety of examples that should cover almost any scenario you can possibly think of. Just one thing, do not try and be a cut/paste god here. Actually take time to read the examples and understand what they do before you put them into production. This will now end my How to use Google segment for the day. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload utility ?
On Mon, Feb 7, 2011 at 11:03, Frank Bonnet f.bon...@esiee.fr wrote: I found nothing that's why I wrote this !!! My point is, you only told everyone what you're trying to do. Not once did you ask a question or mention where you're seeking guidance, other than your ambivalence on file uploads and distribution. The ambiguous nature of your expression makes it even more difficult: you want a utility, not help in authoring it in PHP. This is a PHP programming mailing list for peer-to-peer support by members of the community, not a tell me the name of software I can download to do this job group. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File-Upload per Drag-N-Drop?
On Wed, Dec 29, 2010 at 07:23:25PM +0100, Michelle Konzack wrote: Hello, my users have an Online-File-Store with nearly anything they need but one feature is missing: Drag-D-Drop. I like to implement Drag-D-Drop so users can Drag a file from a File- Manager and Drop it on the Upload-Icon in my Webinterface. Can someone tell me HOW THIS WORKS? This is a client-side question. Javascript can handle drag-n-drop; WordPress does this in its site administration screens. However, it does not do it from a file manager window. In any case, this is a client side, not a PHP question. Paul -- Paul M. Foster http://noferblatz.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File-Upload per Drag-N-Drop?
Hello, my users have an Online-File-Store with nearly anything they need but one feature is missing: Drag-D-Drop. I like to implement Drag-D-Drop so users can Drag a file from a File- Manager and Drop it on the Upload-Icon in my Webinterface. Can someone tell me HOW THIS WORKS? Thanks, Greetings and nice Day/Evening Michelle Konzack -- # Debian GNU/Linux Consultant ## Development of Intranet and Embedded Systems with Debian GNU/Linux itsyst...@tdnet France EURL itsyst...@tdnet UG (limited liability) Owner Michelle KonzackOwner Michelle Konzack Apt. 917 (homeoffice) 50, rue de Soultz Kinzigstraße 17 67100 Strasbourg/France 77694 Kehl/Germany Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil Tel: +33-9-52705884 fix http://www.itsystems.tamay-dogan.net/ http://www.flexray4linux.org/ http://www.debian.tamay-dogan.net/ http://www.can4linux.org/ Jabber linux4miche...@jabber.ccc.de Linux-User #280138 with the Linux Counter, http://counter.li.org/ signature.pgp Description: Digital signature
Re: [PHP] File-Upload per Drag-N-Drop?
On Wed, Dec 29, 2010 at 13:23, Michelle Konzack linux4miche...@tamay-dogan.net wrote: Hello, my users have an Online-File-Store with nearly anything they need but one feature is missing: Drag-D-Drop. I like to implement Drag-D-Drop so users can Drag a file from a File- Manager and Drop it on the Upload-Icon in my Webinterface. Can someone tell me HOW THIS WORKS? That's more of a frontend question to which you and your six-million-line signature should check Google to find the answer. Don't get me wrong, Michelle, we've always tried to help out even with off-topic questions, but this is really pushing it a bit too far with all of the non-PHP questions you've been asking lately. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File-Upload per Drag-N-Drop?
-Original Message- From: Michelle Konzack [mailto:linux4miche...@tamay-dogan.net] Sent: Wednesday, December 29, 2010 10:23 AM To: PHP - General Subject: [PHP] File-Upload per Drag-N-Drop? Hello, my users have an Online-File-Store with nearly anything they need but one feature is missing: Drag-D-Drop. I like to implement Drag-D-Drop so users can Drag a file from a File- Manager and Drop it on the Upload-Icon in my Webinterface. Can someone tell me HOW THIS WORKS? This sounds like RIA = Rich Internet Application. Try google'ing for it. YMMV depends on platform technology supported. Regards, Tommy Thanks, Greetings and nice Day/Evening Michelle Konzack -- # Debian GNU/Linux Consultant ## Development of Intranet and Embedded Systems with Debian GNU/Linux itsyst...@tdnet France EURL itsyst...@tdnet UG (limited liability) Owner Michelle KonzackOwner Michelle Konzack Apt. 917 (homeoffice) 50, rue de Soultz Kinzigstraße 17 67100 Strasbourg/France 77694 Kehl/Germany Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil Tel: +33-9-52705884 fix http://www.itsystems.tamay-dogan.net/ http://www.flexray4linux.org/ http://www.debian.tamay-dogan.net/ http://www.can4linux.org/ Jabber linux4miche...@jabber.ccc.de Linux-User #280138 with the Linux Counter, http://counter.li.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File-Upload per Drag-N-Drop?
On Wed, Dec 29, 2010 at 10:30 AM, Daniel P. Brown daniel.br...@parasane.net wrote: That's more of a frontend question to which you and your six-million-line signature should check Google to find the answer. Don't get me wrong, Michelle, we've always tried to help out even with off-topic questions, but this is really pushing it a bit too far with all of the non-PHP questions you've been asking lately. a) +1 - this isn't php-general anymore this feels like michelle-development-requests (with a horribly long signature) - but I don't mean to be harsh. b) HTML5 should be what you want, at some point very soon. Silverlight isn't fully cross platform Java is your most universal applet language fFash has odd issues, but would be second best but HTML5, that's going to address it all. Google for plupload it has all the different upload applet types and tries to determine which one will be best for you. has the client side and server side pieces included. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File-Upload per Drag-N-Drop?
On a slight tangent, but is that signature why I'm not able to read any of michelles emails on my phone? For some reason, only her emails get stuck and won't download, so I have to wait til someone else replies. To answer the question on this, I've not yet seen a cross platform answer to this question; only several different platform dependent solutions from one vendor to handle each main OS. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Michael Shadle mike...@gmail.com Date: Wed, Dec 29, 2010 21:38 Subject: [PHP] File-Upload per Drag-N-Drop? To: Michelle Konzack linux4miche...@tamay-dogan.net Cc: PHP - General php-general@lists.php.net On Wed, Dec 29, 2010 at 10:30 AM, Daniel P. Brown daniel.br...@parasane.net wrote: That's more of a frontend question to which you and your six-million-line signature should check Google to find the answer. Don't get me wrong, Michelle, we've always tried to help out even with off-topic questions, but this is really pushing it a bit too far with all of the non-PHP questions you've been asking lately. a) +1 - this isn't php-general anymore this feels like michelle-development-requests (with a horribly long signature) - but I don't mean to be harsh. b) HTML5 should be what you want, at some point very soon. Silverlight isn't fully cross platform Java is your most universal applet language fFash has odd issues, but would be second best but HTML5, that's going to address it all. Google for plupload it has all the different upload applet types and tries to determine which one will be best for you. has the client side and server side pieces included. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Upload
Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
Ali Reza Sajedi wrote on 30/01/2010 12:27: UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? What does print phpinfo(); tell you about the upload_tmp_dir? -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
On Sat, Jan 30, 2010 at 7:27 PM, Ali Reza Sajedi arsaj...@khanehjou.comwrote: Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? It might be the upload_tmp_dir no pointing to the right dir ! What is the current of it ? Regards, Eric, Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
Thank you for your replys. In php.ini upload_tmp_dir is not set, so that the system should use its default tmp folder. It used to work properly. But, after a system update from centos5.3 to centos5.4 this malfunction is now observed. Any idea? Kind regards Ali - Original Message - From: Eric Lee To: Ali Reza Sajedi Cc: phpList list Sent: Saturday, January 30, 2010 1:21 PM Subject: Re: [PHP] File Upload On Sat, Jan 30, 2010 at 7:27 PM, Ali Reza Sajedi arsaj...@khanehjou.com wrote: Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? It might be the upload_tmp_dir no pointing to the right dir ! What is the current of it ? Regards, Eric, Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
On Sat, 2010-01-30 at 14:40 +0100, Ali Reza Sajedi wrote: Thank you for your replys. In php.ini upload_tmp_dir is not set, so that the system should use its default tmp folder. It used to work properly. But, after a system update from centos5.3 to centos5.4 this malfunction is now observed. Any idea? Kind regards Ali - Original Message - From: Eric Lee To: Ali Reza Sajedi Cc: phpList list Sent: Saturday, January 30, 2010 1:21 PM Subject: Re: [PHP] File Upload On Sat, Jan 30, 2010 at 7:27 PM, Ali Reza Sajedi arsaj...@khanehjou.com wrote: Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? It might be the upload_tmp_dir no pointing to the right dir ! What is the current of it ? Regards, Eric, Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The upgrade just changed the setting. If you set this in your php.ini, it should work again. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name']
2009/12/23 Andrei Iarus poni1...@yahoo.com Found the problem: I use Zend Framework, and after using a procedre, it is automatically moved. :( Thanks very much, I thought it was a problem with PHP, but from now on, it is a Zend Framework problem. Thanks again. --- On Wed, 12/23/09, Richard Quadling rquadl...@googlemail.com wrote: From: Richard Quadling rquadl...@googlemail.com Subject: Re: [PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name'] To: Andrei Iarus poni1...@yahoo.com, PHP General list php-general@lists.php.net Date: Wednesday, December 23, 2009, 7:52 PM 2009/12/23 Andrei Iarus poni1...@yahoo.com: Of course: also tried the is_uploaded_file, exactly like in the manual. And it fails :( --- On Wed, 12/23/09, Richard Quadling rquadl...@googlemail.com wrote: From: Richard Quadling rquadl...@googlemail.com Subject: Re: [PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name'] To: Andrei Iarus poni1...@yahoo.com Cc: php-general@lists.php.net Date: Wednesday, December 23, 2009, 6:10 PM 2009/12/22 Andrei Iarus poni1...@yahoo.com: Hello, On my production testing servers (production runs on a centrino and testing runs on Windows) I can only access the temporary uploaded file using ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name']; while the file $_FILES['filename']['tmp_name'] simply does not exist (checked with file_exists() function, and also looking in the temporary folder). Is there a problem with my PHP installations? Is there any directive to change this bihaviour? On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0 Thanks in advance. 2 functions to get to grips with: 1 - is_uploaded_file() 2 - move_uploaded_file() Example from http://php.net/is_uploaded_file ?php if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo File . $_FILES['userfile']['name'] . uploaded successfully.\n; echo Displaying contents\n; readfile($_FILES['userfile']['tmp_name']); } else { echo Possible file upload attack: ; echo filename '. $_FILES['userfile']['tmp_name'] . '.; } ? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling What version of Windows? Can you provide a really basic test? And a var_dump($_FILES) please? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling Glad you got it worked out. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name']
2009/12/22 Andrei Iarus poni1...@yahoo.com: Hello, On my production testing servers (production runs on a centrino and testing runs on Windows) I can only access the temporary uploaded file using ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name']; while the file $_FILES['filename']['tmp_name'] simply does not exist (checked with file_exists() function, and also looking in the temporary folder). Is there a problem with my PHP installations? Is there any directive to change this bihaviour? On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0 Thanks in advance. 2 functions to get to grips with: 1 - is_uploaded_file() 2 - move_uploaded_file() Example from http://php.net/is_uploaded_file ?php if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo File . $_FILES['userfile']['name'] . uploaded successfully.\n; echo Displaying contents\n; readfile($_FILES['userfile']['tmp_name']); } else { echo Possible file upload attack: ; echo filename '. $_FILES['userfile']['tmp_name'] . '.; } ? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name']
2009/12/23 Andrei Iarus poni1...@yahoo.com: Of course: also tried the is_uploaded_file, exactly like in the manual. And it fails :( --- On Wed, 12/23/09, Richard Quadling rquadl...@googlemail.com wrote: From: Richard Quadling rquadl...@googlemail.com Subject: Re: [PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name'] To: Andrei Iarus poni1...@yahoo.com Cc: php-general@lists.php.net Date: Wednesday, December 23, 2009, 6:10 PM 2009/12/22 Andrei Iarus poni1...@yahoo.com: Hello, On my production testing servers (production runs on a centrino and testing runs on Windows) I can only access the temporary uploaded file using ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name']; while the file $_FILES['filename']['tmp_name'] simply does not exist (checked with file_exists() function, and also looking in the temporary folder). Is there a problem with my PHP installations? Is there any directive to change this bihaviour? On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0 Thanks in advance. 2 functions to get to grips with: 1 - is_uploaded_file() 2 - move_uploaded_file() Example from http://php.net/is_uploaded_file ?php if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo File . $_FILES['userfile']['name'] . uploaded successfully.\n; echo Displaying contents\n; readfile($_FILES['userfile']['tmp_name']); } else { echo Possible file upload attack: ; echo filename '. $_FILES['userfile']['tmp_name'] . '.; } ? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling What version of Windows? Can you provide a really basic test? And a var_dump($_FILES) please? -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload directive: $_FILES['filename']['name'] instead of $_FILES['filename']['tmp_name']
Hello, On my production testing servers (production runs on a centrino and testing runs on Windows) I can only access the temporary uploaded file using ini_get( 'upload_tmp_dir' . '/' . $_FILES['filename']['name']; while the file $_FILES['filename']['tmp_name'] simply does not exist (checked with file_exists() function, and also looking in the temporary folder). Is there a problem with my PHP installations? Is there any directive to change this bihaviour? On production: PHP 5.2.10 and on testing: PHP 5.2.8 and 5.3.0 Thanks in advance.
[PHP] file upload question
Hey all, i am using move_upload function to upload files to the server, but i want to add a feature that will allow files to be archived that have been uploaded already. so, the problem is: i upload a file that i want to upgrade and move the old file to an archive directory but I want to verify the NEW file is upload BEFORE moving the old file (the file being uploaded might not have the same filename as the old file currently on the server).. i want to move the old file only when the new file was successfully uploaded. something like: if(move_uploaded_file()) { rename(...); } only one problem.. then if both files have the same name it will be overwritten before it moves the old one i want to save. if i move the old one first, there still the possibility of the new upload failing so i am back to square one.. i guess i can move_upload to a different directory, verify it's been uploaded, move the old to the archive file, then move the new file back to where it should be (where the archive file was).. is that my only option? any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload question
On Aug 3, 2009, at 7:04 AM, seb sebast...@triponthis.net wrote: Hey all, i am using move_upload function to upload files to the server, but i want to add a feature that will allow files to be archived that have been uploaded already. so, the problem is: i upload a file that i want to upgrade and move the old file to an archive directory but I want to verify the NEW file is upload BEFORE moving the old file (the file being uploaded might not have the same filename as the old file currently on the server).. i want to move the old file only when the new file was successfully uploaded. something like: only one problem.. then if both files have the same name it will be overwritten before it moves the old one i want to save. if i move the old one first, there still the possibility of the new upload failing so i am back to square one.. i guess i can move_upload to a different directory, verify it's been uploaded, move the old to the archive file, then move the new file back to where it should be (where the archive file was).. is that my only option? any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Do an check for the file before moving it If(file_exists($filename)){ // copy file out to archive } }if(move_uploaded_file()) { } Bastien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
-Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Saturday, August 09, 2008 9:09 AM To: php-general@lists.php.net Subject: RE: [PHP] Re: PUT vs. POST (was: php File upload) Boyd, Todd M. wrote: I had to use Java for the simple fact that PHP by itself cannot access the local file system in a way that allows for the partial loading of files. Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Gee.. I get the feeling that you didn't read what I wrote in that post. PHP can't access client stuff. No, PHP _CAN'T_ access client stuff! Um... kay? Todd Boyd Web Programmer
[PHP] Re: PUT vs. POST (was: php File upload)
-Original Message- From: mike [mailto:[EMAIL PROTECTED] Sent: Saturday, August 09, 2008 2:47 PM To: Richard Heyes Cc: php-general@lists.php.net Subject: Re: [PHP] Re: PUT vs. POST (was: php File upload) On Aug 9, 2008, at 7:50 AM, Richard Heyes [EMAIL PROTECTED] wrote: Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Wouldn't it be fun though if it could? :-) -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Years ago someone made an activex component to run php on the client. Apparently it went nowhere. Willing to bet it had been completely squashed due to ActiveX vulnerabilities and that Firefox actively refuses ADO. Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
Boyd, Todd M. wrote: I had to use Java for the simple fact that PHP by itself cannot access the local file system in a way that allows for the partial loading of files. Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Gee.. I get the feeling that you didn't read what I wrote in that post. PHP can't access client stuff. No, PHP _CAN'T_ access client stuff! Um... kay? Todd, I just wanted to stress that there is NO way for PHP to access anything on the client. The way you wrote it, you sort of implied that there might be other ways: PHP by itself cannot access the local file system in a way that allows ... That's all. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
At 6:33 PM +0200 8/11/08, Per Jessen wrote: Boyd, Todd M. wrote: I had to use Java for the simple fact that PHP by itself cannot access the local file system in a way that allows for the partial loading of files. Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. -snip- Todd, I just wanted to stress that there is NO way for PHP to access anything on the client. The way you wrote it, you sort of implied that there might be other ways: PHP by itself cannot access the local file system in a way that allows ... That's all. The above is saying two different things. 1). PHP by itself cannot access the local file system -- true. 2) ... there is NO way for PHP to access anything on the client. -- not true. Javascript can access some stuff on the client -- true. Javascript and php can communicate -- also true. Therefore, anything that javascript can access can be provided to php, thus proving [2] wrong. Now, if I'm wrong, please show me something that javascript can get that can't be provided to php. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
tedd wrote: Todd, I just wanted to stress that there is NO way for PHP to access anything on the client. The way you wrote it, you sort of implied that there might be other ways: PHP by itself cannot access the local file system in a way that allows ... That's all. The above is saying two different things. 1). PHP by itself cannot access the local file system -- true. 2) ... there is NO way for PHP to access anything on the client. -- not true. Statement 2 _is_ 100% true. Sorry, end of discussion for my part. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
-Original Message- From: Per Jessen [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2008 1:17 PM To: php-general@lists.php.net Subject: RE: RE: [PHP] Re: PUT vs. POST (was: php File upload) tedd wrote: Todd, I just wanted to stress that there is NO way for PHP to access anything on the client. The way you wrote it, you sort of implied that there might be other ways: PHP by itself cannot access the local file system in a way that allows ... That's all. The above is saying two different things. 1). PHP by itself cannot access the local file system -- true. 2) ... there is NO way for PHP to access anything on the client. -- not true. Statement 2 _is_ 100% true. Sorry, end of discussion for my part. I think there is a difference in definition going on here. An object in the local filesystem (though not the original copy of it, but a facsimile rendered through Javascript) can be accessed from PHP, though not in its original form, but wrapped in an AJAX request--or hidden INPUT tag, etc. (in the form of encoded text)--and then manipulated. That's what I *MEANT* to say. :P Todd Boyd Web Programmer
RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
At 8:17 PM +0200 8/11/08, Per Jessen wrote: tedd wrote: 2) ... there is NO way for PHP to access anything on the client. -- not true. Statement 2 _is_ 100% true. Sorry, end of discussion for my part. /Per Jessen, Zürich Per Jessen: I am sure you are smarter than this -- you're probably not understanding what I am saying. I write code daily that communicates between javascript and php. As such, data that is on the client-side can passed to the server-side effortlessly -- javascript does that very well and if you don't want to entertain a refresh, you can even use ajax. PHP can even write javascript to do this and sit waiting for a reply back -- it's simply a matter of timing. Here's an example of php and javascript playing well together: http://webbytedd.com/b/timed-php/ Are you saying that this is not possible? I think not -- I think one of us is not understanding what the other is saying -- which is it? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] Re: PUT vs. POST (was: php File upload)
On 8/11/08, tedd [EMAIL PROTECTED] wrote: Per Jessen: I am sure you are smarter than this -- you're probably not understanding what I am saying. No, Per is correct. PHP itself cannot access anything on the client. It is a server-parsed language. The client never executes PHP, period. Javascript, other applets, etc. can *inform* or push information to PHP about the client or files on the client, but PHP itself has no idea what is going on other than $_SERVER, $_COOKIE vars and whatnot identifying the browser. That's all it gets without something else helping it, and that is still not -PHP- itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: RE: [PHP] Re: PUT vs. POST (was: php File upload)
At 2:07 PM -0500 8/11/08, Boyd, Todd M. wrote: I think there is a difference in definition going on here. -snip- Todd: I think you are right -- there must be some type of disconnect going on here because it's obvious that php can receive data from javascript. It's also obvious that javascript works client-side. Therefore, php can receive data from client-side -- to claim otherwise is nonsense. Per Jessen must be talking about something else. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] Re: PUT vs. POST (was: php File upload)
At 12:19 PM -0700 8/11/08, mike wrote: On 8/11/08, tedd [EMAIL PROTECTED] wrote: Per Jessen: I am sure you are smarter than this -- you're probably not understanding what I am saying. No, Per is correct. PHP itself cannot access anything on the client. It is a server-parsed language. The client never executes PHP, period. Javascript, other applets, etc. can *inform* or push information to PHP about the client or files on the client, but PHP itself has no idea what is going on other than $_SERVER, $_COOKIE vars and whatnot identifying the browser. That's all it gets without something else helping it, and that is still not -PHP- itself. Arrrggg!!! Read! I said: 1). PHP by itself cannot access the local file system -- true. Now, do you agree with that?! Isn't that the SAME as what you said above?! Now, why not read the rest of what I wrote? Sometimes it's hard to get an idea across because some people refuse to read, but love to comment about the obvious. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] Re: PUT vs. POST (was: php File upload)
On 8/11/08, tedd [EMAIL PROTECTED] wrote: Now, do you agree with that?! Isn't that the SAME as what you said above?! Now, why not read the rest of what I wrote? Sometimes it's hard to get an idea across because some people refuse to read, but love to comment about the obvious. Or this conversation has become a hassle to pay attention to and I'm not going to waste time since gmail has compressed all the common text on each conversation trying to flip through it. Originally this was a decent idea for discussion since this interests me, but the thread has been hijacked into a semantics discussion now. So I decided I've seen enough of this back and forth and posted something. I therefore request we stop this discussion or put it into another thread about PHP vs. clientside crap, and let POST vs. PUT resume discussion if that's even still alive. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PUT vs. POST (was: php File upload)
Boyd, Todd M. wrote: I had to use Java for the simple fact that PHP by itself cannot access the local file system in a way that allows for the partial loading of files. Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST (was: php File upload)
Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Wouldn't it be fun though if it could? :-) -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST (was: php File upload)
At 3:50 PM +0100 8/9/08, Richard Heyes wrote: Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Wouldn't it be fun though if it could? :-) -- Richard Heyes In a round about way it can, but it's limited. You see, anything that javascript can discover can be passed to php. The limits are those limits imposed on javascript. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST (was: php File upload)
Except if paired with javadcript. Luke Slater Lead Developer NuVoo On 9 Aug 2008, at 15:09, Per Jessen [EMAIL PROTECTED] wrote: Boyd, Todd M. wrote: I had to use Java for the simple fact that PHP by itself cannot access the local file system in a way that allows for the partial loading of files. Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. /Per Jessen, Zürich -- 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] Re: PUT vs. POST (was: php File upload)
tedd wrote: At 3:50 PM +0100 8/9/08, Richard Heyes wrote: Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Wouldn't it be fun though if it could? :-) -- Richard Heyes In a round about way it can, but it's limited. No, it cannot. You see, anything that javascript can discover can be passed to php. The limits are those limits imposed on javascript. Ah, so you mean that _javascript_ can access something on the client - very true, but javascript!=PHP. Of course PHP can do all sorts if you combine it with javascript, black magic, or what have you, but PHP alone is a server side scripting language, nothing more nor less. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST (was: php File upload)
On Aug 9, 2008, at 7:50 AM, Richard Heyes [EMAIL PROTECTED] wrote: Given that PHP doesn't run on the client, there is no way for anything written in PHP to access anything on the client. Wouldn't it be fun though if it could? :-) -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Years ago someone made an activex component to run php on the client. Apparently it went nowhere. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST (was: php File upload)
At 8:20 PM +0200 8/9/08, Per Jessen wrote: tedd wrote: You see, anything that javascript can discover can be passed to php. The limits are those limits imposed on javascript. Ah, so you mean that _javascript_ can access something on the client - very true, but javascript!=PHP. Of course PHP can do all sorts if you combine it with javascript, black magic, or what have you, but PHP alone is a server side scripting language, nothing more nor less. While js != php, they can communicate and that's what I was saying. There's nothing that js can discover that can't be passed to php and back again -- js and php can communicate and play together. Here's an example: http://webbytedd.com/b/timed-php/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Jim Lucas wrote: What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Correct. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. Also correct. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. Well, I can easily show you such a case - I can upload a 1Gb file without apache memory usage changing one bit. Even if Apache did upload into memory, why would that make the file limited to the max amount of physical memory?? How about if I upload a 1Gb file to a webserver on a machine that only has 256Mb memory - would you say that's impossible? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
I think the sentiment is that you can't fit all of the file in the memory at once Luke Slater On 8 Aug 2008, at 07:59, Per Jessen [EMAIL PROTECTED] wrote: Jim Lucas wrote: What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Correct. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. Also correct. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. Well, I can easily show you such a case - I can upload a 1Gb file without apache memory usage changing one bit. Even if Apache did upload into memory, why would that make the file limited to the max amount of physical memory?? How about if I upload a 1Gb file to a webserver on a machine that only has 256Mb memory - would you say that's impossible? /Per Jessen, Zürich -- 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] php File upload
Luke wrote: I think the sentiment is that you can't fit all of the file in the memory at once Which would be absolutely true, but irrelevant - the question is whether that would prevent me from uploading it? That is the problem Tom seems to be having. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Hello on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? no need for swap my system OpenSuSE 10.3 512MB RAM my uploaded file -rw-r--r-- 1 wwwrun www 10 8. Aug 09:39 mytestfile.out memory befor upload and during upload are nearly the same and no swap total used free sharedbuffers cached Mem:510488 504728 5760 0 60728 301476 -/+ buffers/cache: 142524 367964 Swap: 2104432 287562075676 a du shows that the tmp file is greater as the memory du -h /tmp/phpMmAGdN 659M/tmp/phpMmAGdN and grows du -h /tmp/phpMmAGdN 663M/tmp/phpMmAGdN So i think your script is wrong maybe you trie to read the hole contend from the upload file in a variable so you reach the memory post your script ro see if its is correct. BR/Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Maybe there is some configuration in the server somewhere causing it to incorrectly use the tmp? Luke Slater On 8 Aug 2008, at 08:48, Torsten Rosenberger [EMAIL PROTECTED] wrote: Hello on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? no need for swap my system OpenSuSE 10.3 512MB RAM my uploaded file -rw-r--r-- 1 wwwrun www 10 8. Aug 09:39 mytestfile.out memory befor upload and during upload are nearly the same and no swap total used free sharedbuffers cached Mem:510488 504728 5760 0 60728 301476 -/+ buffers/cache: 142524 367964 Swap: 2104432 287562075676 a du shows that the tmp file is greater as the memory du -h /tmp/phpMmAGdN 659M/tmp/phpMmAGdN and grows du -h /tmp/phpMmAGdN 663M/tmp/phpMmAGdN So i think your script is wrong maybe you trie to read the hole contend from the upload file in a variable so you reach the memory post your script ro see if its is correct. BR/Torsten -- 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] php File upload
Am Freitag, den 08.08.2008, 09:00 +0100 schrieb Luke: Maybe there is some configuration in the server somewhere causing it to incorrectly use the tmp? normla config php.ini ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = /tmp ; Maximum allowed size for uploaded files. upload_max_filesize = 1500M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php File upload
Problem solved (at one machine)! I can upload a ~ 2 GB File now on a machine with 1 GB Main Memory! No Problem, swap is used but no break now. The answer is, i think, the dramatical overhead for http upload, simply my post_max_size and upload_max_size are to small. If i will upload 1 GB it must minimum 1.5 GB (better more) on this limit variables. Im very glad to fix this problem, but the next one is here: Other machine (but 2 GB Ram), same suse version, same (working now) php.ini with limits to 5000M now and i can't upload a File greater than 900MB. A file under 900MB i see the tmp file growing. A File with +1 GB no temp file seeing at all and break after a view minutes. It's horrible with no error codes and wasting pure of time :-( Now i begin at bottom on this machine. Thanx for alle, who look for this problem. Now we are the very only that can say that php 100% working file uploads if memory lower than the file size :-) Tom [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php File upload
Tom wrote: Im very glad to fix this problem, but the next one is here: Other machine (but 2 GB Ram), same suse version, same (working now) php.ini with limits to 5000M now and i can't upload a File greater than 900MB. A file under 900MB i see the tmp file growing. A File with +1 GB no temp file seeing at all and break after a view minutes. It's horrible with no error codes and wasting pure of time :-( The maximum size of an HTTP request is 2Gb. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php File upload
Per Jessen wrote: Tom wrote: Im very glad to fix this problem, but the next one is here: Other machine (but 2 GB Ram), same suse version, same (working now) php.ini with limits to 5000M now and i can't upload a File greater than 900MB. A file under 900MB i see the tmp file growing. A File with +1 GB no temp file seeing at all and break after a view minutes. It's horrible with no error codes and wasting pure of time :-( The maximum size of an HTTP request is 2Gb. /Per Jessen, Zürich Also bear in mind that the file is MIME encoded (so probably actually a base-64 stream or some such) and the actual size of the data sent in the request is therefore likely to be some fraction bigger than the file itself (like 33% bigger for base-64 encoding) -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php File upload
You could always program in something (perhaps in Ajax) to monitor the progress of the file upload and check for errors periodically. Luke Slater On 8 Aug 2008, at 11:55, Peter Ford [EMAIL PROTECTED] wrote: Per Jessen wrote: Tom wrote: Im very glad to fix this problem, but the next one is here: Other machine (but 2 GB Ram), same suse version, same (working now) php.ini with limits to 5000M now and i can't upload a File greater than 900MB. A file under 900MB i see the tmp file growing. A File with +1 GB no temp file seeing at all and break after a view minutes. It's horrible with no error codes and wasting pure of time :-( The maximum size of an HTTP request is 2Gb. /Per Jessen, Zürich Also bear in mind that the file is MIME encoded (so probably actually a base-64 stream or some such) and the actual size of the data sent in the request is therefore likely to be some fraction bigger than the file itself (like 33% bigger for base-64 encoding) -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- 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] Re: php File upload
What is set this limit? Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Im very glad to fix this problem, but the next one is here: Other machine (but 2 GB Ram), same suse version, same (working now) php.ini with limits to 5000M now and i can't upload a File greater than 900MB. A file under 900MB i see the tmp file growing. A File with +1 GB no temp file seeing at all and break after a view minutes. It's horrible with no error codes and wasting pure of time :-( The maximum size of an HTTP request is 2Gb. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php File upload
Tom wrote: Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Im very glad to fix this problem, but the next one is here: Other machine (but 2 GB Ram), same suse version, same (working now) php.ini with limits to 5000M now and i can't upload a File greater than 900MB. A file under 900MB i see the tmp file growing. A File with +1 GB no temp file seeing at all and break after a view minutes. It's horrible with no error codes and wasting pure of time :-( The maximum size of an HTTP request is 2Gb. What is set this limit? I can't find it, but I'm pretty certain it's in RFC2616. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Hi Per, your result is on a suse 8.2 ? hmm, i don't know the reason why my suse 10.2 machines do that failure. My limits for for post_max_size and upload_max_size is both 1500M. Greets thanx, Tom Tom, check your maximum PHP execution time. I've just done some testing where the upload was interrupted after 60seconds with this error: PHP Fatal error: Maximum execution time of 60 seconds exceeded in Unknown on line 0, referer: http://tintin/uploadbig.php I increased time to 240seconds, and had no problem uploading a 1Gb file. This was on a openSUSE 10.3 system with only 256M RAM. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Per Jessen wrote: Jim Lucas wrote: I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. Well, I can easily show you such a case - I can upload a 1Gb file without apache memory usage changing one bit. Even if Apache did upload into memory, why would that make the file limited to the max amount of physical memory?? How about if I upload a 1Gb file to a webserver on a machine that only has 256Mb memory - would you say that's impossible? Just did that (1Gb file uploaded to machine with 256M RAM) - Apache definitely does _not_ store the uploaded file in memory, I also straced the upload, and it's 1) read from socket followed by 2) write to disk. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Hi Per, Execution Time ist set to 72000, i learned to set it not to low for tests :-) I learned also the last days many things about the php.ini. Many changes affect later, its mostly for me a trial and error thing and results in much phenomenon. At moment its okay, i can upload 1.2 Gb, no problem. I test to upload a 1.9 GB file (reading the max is 2GB a browser can handle), but this failes. I don't know is this the overhead or what else. Now i search the max value Browseres can handle for input type=hidden name=MAX_FILE_SIZE value= /. Know you this value? Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Hi Per, your result is on a suse 8.2 ? hmm, i don't know the reason why my suse 10.2 machines do that failure. My limits for for post_max_size and upload_max_size is both 1500M. Greets thanx, Tom Tom, check your maximum PHP execution time. I've just done some testing where the upload was interrupted after 60seconds with this error: PHP Fatal error: Maximum execution time of 60 seconds exceeded in Unknown on line 0, referer: http://tintin/uploadbig.php I increased time to 240seconds, and had no problem uploading a 1Gb file. This was on a openSUSE 10.3 system with only 256M RAM. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Hi Per, Execution Time ist set to 72000, i learned to set it not to low for tests :-) I learned also the last days many things about the php.ini. Many changes affect later, its mostly for me a trial and error thing and results in much phenomenon. At moment its okay, i can upload 1.2 Gb, no problem. I test to upload a 1.9 GB file (reading the max is 2GB a browser can handle), but this failes. I don't know is this the overhead or what else. Well, it seems to me that you've achieved what you need, right? You don't need one big upload, you need many smaller but concurrent uploads, yeah? I'll try a bigger file later today and see what happens. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Practical i implement a robust filebase in my new gamer portal and go to max. at upload values. If the users make a big upload, it should be stable. I think, later (after release) i will enhance it with a ftp port. But not yet. Here you can see, what i have in filebase, but a 1.9 GB upload fails. I don't know if this is the overhead. http://www.guildmeets.de/index.php?onlydirid=78 (in Folder Neue Game Demos) Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Hi Per, Execution Time ist set to 72000, i learned to set it not to low for tests :-) I learned also the last days many things about the php.ini. Many changes affect later, its mostly for me a trial and error thing and results in much phenomenon. At moment its okay, i can upload 1.2 Gb, no problem. I test to upload a 1.9 GB file (reading the max is 2GB a browser can handle), but this failes. I don't know is this the overhead or what else. Well, it seems to me that you've achieved what you need, right? You don't need one big upload, you need many smaller but concurrent uploads, yeah? I'll try a bigger file later today and see what happens. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Is a 1.9 gb file upload even sustainable on even a fairly small scale web application? Maybe you could implement FTP if you trust the people that want to upload the file. Luke Slater Lead Developer NuVoo On 9 Aug 2008, at 14:52, Tom [EMAIL PROTECTED] wrote: Practical i implement a robust filebase in my new gamer portal and go to max. at upload values. If the users make a big upload, it should be stable. I think, later (after release) i will enhance it with a ftp port. But not yet. Here you can see, what i have in filebase, but a 1.9 GB upload fails. I don't know if this is the overhead. http://www.guildmeets.de/index.php?onlydirid=78 (in Folder Neue Game Demos) Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Hi Per, Execution Time ist set to 72000, i learned to set it not to low for tests :-) I learned also the last days many things about the php.ini. Many changes affect later, its mostly for me a trial and error thing and results in much phenomenon. At moment its okay, i can upload 1.2 Gb, no problem. I test to upload a 1.9 GB file (reading the max is 2GB a browser can handle), but this failes. I don't know is this the overhead or what else. Well, it seems to me that you've achieved what you need, right? You don't need one big upload, you need many smaller but concurrent uploads, yeah? I'll try a bigger file later today and see what happens. /Per Jessen, Zürich -- 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] php File upload
Per Jessen wrote: How about if I upload a 1Gb file to a webserver on a machine that only has 256Mb memory - would you say that's impossible? /Per Jessen, Zürich In my experience that would the correct. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Practical i implement a robust filebase in my new gamer portal and go to max. at upload values. If the users make a big upload, it should be stable. I think, later (after release) i will enhance it with a ftp port. But not yet. Here you can see, what i have in filebase, but a 1.9 GB upload fails. I don't know if this is the overhead. http://www.guildmeets.de/index.php?onlydirid=78 OK, I've also just tried uploading bigger files - 1280Mb,1536Mb,180MB are fine, but 1900Mb fails. I'll do that again with strace and see if I can spot something obvious - I didn't see any errors etc. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Per Jessen wrote: Tom wrote: Practical i implement a robust filebase in my new gamer portal and go to max. at upload values. If the users make a big upload, it should be stable. I think, later (after release) i will enhance it with a ftp port. But not yet. Here you can see, what i have in filebase, but a 1.9 GB upload fails. I don't know if this is the overhead. http://www.guildmeets.de/index.php?onlydirid=78 OK, I've also just tried uploading bigger files - 1280Mb,1536Mb,180MB are fine, but 1900Mb fails. I'll do that again with strace and see if I can spot something obvious - I didn't see any errors etc. This time I had set the upload_file_size and post_max_size to 3000Mb each, which probably didn't work. When I tried the 1900Mb file again I got this error: [Fri Aug 08 16:57:28 2008] [error] [client 192.168.2.113] PHP Warning: POST Content-Length of 1992294868 bytes exceeds the limit of -1149239296 bytes in Unknown on line 0, referer /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
On Fri, Aug 8, 2008 at 11:14 AM, Per Jessen [EMAIL PROTECTED] wrote: Per Jessen wrote: Tom wrote: Practical i implement a robust filebase in my new gamer portal and go to max. at upload values. If the users make a big upload, it should be stable. I think, later (after release) i will enhance it with a ftp port. But not yet. Here you can see, what i have in filebase, but a 1.9 GB upload fails. I don't know if this is the overhead. http://www.guildmeets.de/index.php?onlydirid=78 OK, I've also just tried uploading bigger files - 1280Mb,1536Mb,180MB are fine, but 1900Mb fails. I'll do that again with strace and see if I can spot something obvious - I didn't see any errors etc. This time I had set the upload_file_size and post_max_size to 3000Mb each, which probably didn't work. When I tried the 1900Mb file again I got this error: [Fri Aug 08 16:57:28 2008] [error] [client 192.168.2.113] PHP Warning: POST Content-Length of 1992294868 bytes exceeds the limit of -1149239296 bytes in Unknown on line 0, referer /Per Jessen, Zürich Just a guess 3000MB exceeds the value of a 4-byte integer when converted to bytes. -1149239296 is the signed equivalent of 3145728000, which is 3000 * 1024 * 1024. I'm guessing that since the upload size is greater than a (really large) negative number, PHP is throwing an error. That's probably where the 2GB figure comes from. Andrew
Re: [PHP] php File upload
Andrew Ballard wrote: This time I had set the upload_file_size and post_max_size to 3000Mb each, which probably didn't work. When I tried the 1900Mb file again I got this error: [Fri Aug 08 16:57:28 2008] [error] [client 192.168.2.113] PHP [Warning: POST Content-Length of 1992294868 bytes exceeds the limit of -1149239296 bytes in Unknown on line 0, referer /Per Jessen, Zürich Just a guess 3000MB exceeds the value of a 4-byte integer when converted to bytes. -1149239296 is the signed equivalent of 3145728000, which is 3000 * 1024 * 1024. Ah, well spotted. So the max request size is stored as a signed 32bit number. I'm guessing that since the upload size is greater than a (really large) negative number, PHP is throwing an error. That's probably where the 2GB figure comes from. That's certainly one place, but the 2Gb limitation is from HTTP or from apache. It's mentioned in the apache manual under LimitRequestBody'. This directive specifies the number of bytes from 0 (meaning unlimited) to 2147483647 (2GB) that are allowed in a request body. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Andrew write the answer: -1149239296 Bytes is indiz for to big. This time I had set the upload_file_size and post_max_size to 3000Mb each, which probably didn't work. When I tried the 1900Mb file again I got this error: [Fri Aug 08 16:57:28 2008] [error] [client 192.168.2.113] PHP Warning: POST Content-Length of 1992294868 bytes exceeds the limit of -1149239296 bytes in Unknown on line 0, referer /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
On 8/8/08, Luke [EMAIL PROTECTED] wrote: Is a 1.9 gb file upload even sustainable on even a fairly small scale web application? Maybe you could implement FTP if you trust the people that want to upload the file. This is why I am pushing for people to use PUT. Still over HTTP, uploaders can be coded to be 'smart' and resume, re-transmit on failure, etc. It does however require applet (java, flash, etc) or thick client support on the client, and a server that understands the DAV request. I have it working in nginx right now. Need to test large files and watch PHP's memory consumption, since I am spoonfeeding the file to PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
On Fri, Aug 8, 2008 at 1:08 PM, mike [EMAIL PROTECTED] wrote: On 8/8/08, Luke [EMAIL PROTECTED] wrote: Is a 1.9 gb file upload even sustainable on even a fairly small scale web application? Maybe you could implement FTP if you trust the people that want to upload the file. This is why I am pushing for people to use PUT. Still over HTTP, uploaders can be coded to be 'smart' and resume, re-transmit on failure, etc. It does however require applet (java, flash, etc) or thick client support on the client, and a server that understands the DAV request. I have it working in nginx right now. Need to test large files and watch PHP's memory consumption, since I am spoonfeeding the file to PHP. I've not had to upload such large files over HTTP, so forgive my ignorance, but on the request end isn't the only difference between PUT and POST the verb used in the request (and the intent of the operation)? What can you do with PUT that cannot also be handled the same in POST? I don't see any implementations doing it, but from what I can tell the spec allows you to use Content-Range in the request headers that your client sends to PUT/POST the same way the server sends them in the response headers when serving a GET request. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
On 8/8/08, Andrew Ballard [EMAIL PROTECTED] wrote: I've not had to upload such large files over HTTP, so forgive my ignorance, but on the request end isn't the only difference between PUT and POST the verb used in the request (and the intent of the operation)? What can you do with PUT that cannot also be handled the same in POST? I don't see any implementations doing it, but from what I can tell the spec allows you to use Content-Range in the request headers that your client sends to PUT/POST the same way the server sends them in the response headers when serving a GET request. POST sends mime-encoded PUT is raw (AFAIK) It's basically file exchange friendly. People usually say HTTP isn't for files, FTP is but that's a whole other can of worms especially when you're accepting uploads from -anyone- you have to implement a wacky two-step process, ensure people know how to use FTP, blahblah. Using PUT you can do pure file uploads, have smart clients that tell the server where to resume, it's not mime encoded (so not extra bytes), it can be processed as a web request via PHP, it can be done over SSL for security ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
mike wrote: On 8/8/08, Andrew Ballard [EMAIL PROTECTED] wrote: I've not had to upload such large files over HTTP, so forgive my ignorance, but on the request end isn't the only difference between PUT and POST the verb used in the request (and the intent of the operation)? What can you do with PUT that cannot also be handled the same in POST? I don't see any implementations doing it, but from what I can tell the spec allows you to use Content-Range in the request headers that your client sends to PUT/POST the same way the server sends them in the response headers when serving a GET request. POST sends mime-encoded PUT is raw (AFAIK) That's not necessarily a big difference between the two - mime-encoded can also be plain 8-bit. Using PUT you can do pure file uploads, have smart clients that tell the server where to resume, it's not mime encoded (so not extra bytes), it can be processed as a web request via PHP, it can be done over SSL for security ... Same as POST then :-) (except for the resume bit). I still don't see much of a difference. It doesn't matter much to me, I'd just like to understand what the real difference is. Maybe I need to go and read RFC2616. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
On 8/8/08, Per Jessen [EMAIL PROTECTED] wrote: Same as POST then :-) (except for the resume bit). I still don't see much of a difference. It doesn't matter much to me, I'd just like to understand what the real difference is. Maybe I need to go and read RFC2616. I'm all for using existing POST but it seems like a lot of configuration needs to occur, and PHP is expecting a single stream of data. If the stream is broken, how do you resume it? If you accepted the data raw you could dump the stream to a file until it ends, and then fseek($fp, $offset) when you get a resume request... PUT seems to be expected to be straight old file $x goes here ... I actually am not allowing the file to be put on the filesystem directly but fed to a PHP script. I am totally down for POST since POST is supported by browsers, flash, everything, and PUT has some limitations (java applets aplenty, flash can do it i think but you have to do actual raw socket communication and I haven't found an applet for that yet) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PUT vs. POST (was: php File upload)
mike wrote: On 8/8/08, Per Jessen [EMAIL PROTECTED] wrote: Same as POST then :-) (except for the resume bit). I still don't see much of a difference. It doesn't matter much to me, I'd just like to understand what the real difference is. Maybe I need to go and read RFC2616. I'm all for using existing POST but it seems like a lot of configuration needs to occur, Well, that's not really true unless your requirements for upload go beyond what is considered the norm/default. Large files for instance are not considered the norm, so yes, some additional configuration is necessary. and PHP is expecting a single stream of data. If the stream is broken, how do you resume it? If you accepted the data raw you could dump the stream to a file until it ends, and then fseek($fp, $offset) when you get a resume request... Yes, but that does seem to be the only point about PUT vs. POST. PUT seems to be expected to be straight old file $x goes here ... I actually am not allowing the file to be put on the filesystem directly but fed to a PHP script. I am totally down for POST since POST is supported by browsers, flash, everything, and PUT has some limitations (java applets aplenty, flash can do it i think but you have to do actual raw socket communication and I haven't found an applet for that yet) I am not for or against either, I'm just looking for the right argument for PUT support as it seems to be lacking (and I've never found myself in a situation where PUT was the solution). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
PUT is raw (AFAIK) That sounds good. Have you any link to a basicly methode description? This is a really new methode for me but sounds better than http upload btw. resume function is not bad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST (was: php File upload)
On 8/8/08, Per Jessen [EMAIL PROTECTED] wrote: I am not for or against either, I'm just looking for the right argument for PUT support as it seems to be lacking (and I've never found myself in a situation where PUT was the solution). I need to accept files of various sizes - up to 2GB, maybe even more (if it can be supported) - videos, code samples, zips, pdfs, anything. They're coming from various geographies - so slow unreliable connections must be factored in. HTTP upload even with -large- files on a fast connection can be spotty, due to how many systems are in place between client - server. There is no resume either with straight browser upload... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PUT vs. POST (was: php File upload)
-Original Message- From: mike [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2008 4:36 PM To: Per Jessen Cc: php-general@lists.php.net Subject: Re: [PHP] Re: PUT vs. POST (was: php File upload) On 8/8/08, Per Jessen [EMAIL PROTECTED] wrote: I am not for or against either, I'm just looking for the right argument for PUT support as it seems to be lacking (and I've never found myself in a situation where PUT was the solution). I need to accept files of various sizes - up to 2GB, maybe even more (if it can be supported) - videos, code samples, zips, pdfs, anything. They're coming from various geographies - so slow unreliable connections must be factored in. HTTP upload even with -large- files on a fast connection can be spotty, due to how many systems are in place between client - server. There is no resume either with straight browser upload... My buddy is/was hosting a free licensed-music service that needed segmented uploads. I wrote a Java applet that communicates with a receiver PHP page to upload the file in segments rather than all at once. I got it to successfully upload an MP3, but a few bytes were missing from the destination file. I'll try to go digging through the receiver code and see if I can't find something to post that may give you guys a push in (hopefully) the right direction. I had to use Java for the simple fact that PHP by itself cannot access the local file system in a way that allows for the partial loading of files. If I/we get the source to work, 2GB, 4GB, the contents of the library of congress... all will be feasible. More news at 11, Todd Boyd Web Programmer
[PHP] php File upload
Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? It doesn't need to - as you've noticed, the uploaded file is being written to disk, it's not being kept in memory. This sounds like a php limit problem to me. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
No, ist'not a php limit. The upload is written in main memory, if i look with vmstat, free is going to 0 and the php upload breaks at 0 bytes free. Nothing swap used. Any other ideas? Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? It doesn't need to - as you've noticed, the uploaded file is being written to disk, it's not being kept in memory. This sounds like a php limit problem to me. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: No, ist'not a php limit. The upload is written in main memory, if i look with vmstat, free is going to 0 and the php upload breaks at 0 bytes free. Nothing swap used. Any other ideas? Interesting problem - maybe an apache limit? Lack of diskspace? Permissions? Which error do you get? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
No Apache limit, enough diskspace, no permission problem. Fact is: During upload looking at main memory, goes to 0 and if 0 uploadet tmp File was deleted and no error occur. It was great, if anybody can test such a upload. The uploaded File musst be greater as main memory. While teh uload is running, take a look at memory with vmstat. free is goin to 0, no swap is used. I don't know, that is a suse 10.2 effcet only. Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: No, ist'not a php limit. The upload is written in main memory, if i look with vmstat, free is going to 0 and the php upload breaks at 0 bytes free. Nothing swap used. Any other ideas? Interesting problem - maybe an apache limit? Lack of diskspace? Permissions? Which error do you get? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
No Apache limit, enough diskspace, no permission problem. Fact is: During upload looking at main memory, goes to 0 and if 0 uploadet tmp File was deleted and no error occur. It was great, if anybody can test such a upload. The uploaded File musst be greater as main memory. While teh uload is running, take a look at memory with vmstat. free is goin to 0, no swap is used. I don't know, that is a suse 10.2 effcet only. What happens with a smaller file? Say 500Mb? You could gradually increase the file size until you get the error. -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
smaller files is no problem. The error occoured, if the uploaded File is bigger than the installed main memory. Ok, i know that http ist not designed for big uploads. But on a big website with upload enabled and 30 users upload simultan a 20 MB File, they lost the upload while php hold all in memory/Cache and swap is not used. I don't understand why php write the upload chunck for chunck (i can look this) in upload temp file AND holds the upload in main memory. Richard Heyes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] No Apache limit, enough diskspace, no permission problem. Fact is: During upload looking at main memory, goes to 0 and if 0 uploadet tmp File was deleted and no error occur. It was great, if anybody can test such a upload. The uploaded File musst be greater as main memory. While teh uload is running, take a look at memory with vmstat. free is goin to 0, no swap is used. I don't know, that is a suse 10.2 effcet only. What happens with a smaller file? Say 500Mb? You could gradually increase the file size until you get the error. -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Well, you lost me right about... Well when you started. But memory is cheap...:-/ -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
hmm, memory buying is okay, not the final solution. I think php design fault on this function. It's not comprehensible why php use such a lot main memory for an upload. Richard Heyes [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Well, you lost me right about... Well when you started. But memory is cheap...:-/ -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: But on a big website with upload enabled and 30 users upload simultan a 20 MB File, they lost the upload while php hold all in memory/Cache and swap is not used. I don't understand why php write the upload chunck for chunck (i can look this) in upload temp file AND holds the upload in main memory. Well, I can't reproduce the problem - I uploaded a 1Gb file, and I never saw apache memory usage go beyond 15Mb. Might this problem be in your code processing the uploaded file(s)? In this test I just uploaded the file, I never tried to process it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: hmm, memory buying is okay, not the final solution. I think php design fault on this function. It's not comprehensible why php use such a lot main memory for an upload. Well, PHP doesn't - the upload is apaches job. Once the file is uploaded, PHP is invoked to process it. You do your move_uploaded_file() etc. What do you do to the uploaded file? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
With what linux BS have you tested? No, it isn't the apaches job/problem. I do nothing with the file. Looking for $_FILES Varables and then move_uploaded_file. But i said it before, the problem is not at this point. If i upload the file and watch memory with vmstat, free is going 0, cache is going to top and if free is 0 = temp file was deleted and script witout an error comes back. At the crash point, the File is not complete uploaded, so my $_FILES have no entry about the file specs. Im hanging some days with many tests on differnet machines (alls suse) on this Problem and can't solve it :-( Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: hmm, memory buying is okay, not the final solution. I think php design fault on this function. It's not comprehensible why php use such a lot main memory for an upload. Well, PHP doesn't - the upload is apaches job. Once the file is uploaded, PHP is invoked to process it. You do your move_uploaded_file() etc. What do you do to the uploaded file? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: With what linux BS have you tested? It was an older SUSE Linux 8.2. But the OS shouldn't matter - maybe the PHP release and maybe the apache ditto. No, it isn't the apaches job/problem. I do nothing with the file. Looking for $_FILES Varables and then move_uploaded_file. That's exactly what I just did. But i said it before, the problem is not at this point. If i upload the file and watch memory with vmstat, free is going 0, cache is going to top and if free is 0 = temp file was deleted and script witout an error comes back. At the crash point, the File is not complete uploaded, so my $_FILES have no entry about the file specs. Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. Okay, thats light in the darkness. But i don't have any idea what i can do here. tmp is empty. Look at the first entry, its after the upload start. The last entry is after free = 0 and break. I really have no idea whats going on here. procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 677076 28020 216052001758 370 166 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 1 0 0 667404 28028 225536001758 371 167 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 1 0 660088 28036 231456001760 371 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 1 0 656616 28040 235820001760 372 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 653640 28052 239364001760 372 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 650044 28056 242948001760 372 168 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 1 0 0 642480 28060 250432001760 372 169 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 635536 28068 257244001760 373 170 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 1 0 0 630080 28072 262440001760 373 170 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 624500 28080 267892001760 374 170 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 0 620532 28080 270440001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 0 620904 28080 270440001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 2 0 0 618672 28092 273756001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 613960 28096 278432001762 374 171 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 2 0 114984 28668 768276001788 406 209 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 105932 28684 778608001788 407 210 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us sy id wa 0 0 0 96756 28692 787448001788 407 211 1 0 98 1 linuxserver:/tmp # vmstat procs ---memory-- ---swap-- -io -system-- cpu r b swpd free buff cache si sobibo in cs us
Re: [PHP] php File upload
Tom wrote: Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. Okay, thats light in the darkness. But i don't have any idea what i can do here. tmp is empty. What about the destination directory? Which filesystem are you using? I'll try the 1Gb upload again and see how vmstat reacts. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
i use ext3 Im realy on no limit. destination ist /tmp and is fairly empty. The question is now, if cache full = must hypothetical swap used? ok, im glad to see your result. Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: Ah, so it's not PHP and it's not apache using up your memory - it's your filesystem cache. Check how many files you have in the tmp directory and the destination directory. Okay, thats light in the darkness. But i don't have any idea what i can do here. tmp is empty. What about the destination directory? Which filesystem are you using? I'll try the 1Gb upload again and see how vmstat reacts. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: i use ext3 Im realy on no limit. destination ist /tmp and is fairly empty. The question is now, if cache full = must hypothetical swap used? ok, im glad to see your result. No, high utilization of file system cache will not cause any swapping - file system caching uses whatever is spare. If there's nothing, no caching. AFAIU. I can confirm what you're seeing about the cache being used up - I saw that too. My cache-number only went to about 485000, and free only down to 6000-7000. My webserver also has 1Gb RAM, but it does a few more things. Does your free memory actually go as low as 0? I don't think this is about the file system cache - I know you said no limits, but what do you have for post_max_size and upload_max_size ? I'm using 1200M for both for this test. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Hi Per, your result is on a suse 8.2 ? hmm, i don't know the reason why my suse 10.2 machines do that failure. My limits for for post_max_size and upload_max_size is both 1500M. Greets thanx, Tom Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Tom wrote: i use ext3 Im realy on no limit. destination ist /tmp and is fairly empty. The question is now, if cache full = must hypothetical swap used? ok, im glad to see your result. No, high utilization of file system cache will not cause any swapping - file system caching uses whatever is spare. If there's nothing, no caching. AFAIU. I can confirm what you're seeing about the cache being used up - I saw that too. My cache-number only went to about 485000, and free only down to 6000-7000. My webserver also has 1Gb RAM, but it does a few more things. Does your free memory actually go as low as 0? I don't think this is about the file system cache - I know you said no limits, but what do you have for post_max_size and upload_max_size ? I'm using 1200M for both for this test. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom After reading this thread, I would like to add my thoughts. What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. I have worked on Debian (potato|woody|sarge), Redhat 5.0 - 9, Fedora 1 - 7, OpenBSD 3.6-current, and older versions of NetBSD and FreeBSD. I have also frequented a number of friends installs and I have never seen uploads happen any other way. Nor have I heard of uploads happening any other way. Just my 2cents :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php File upload
Tom's machine only has 1 GB of physical memory doesn't it? Could that be the problem? 2008/8/7 Jim Lucas [EMAIL PROTECTED] Tom wrote: Hi, on a linux system (Suese 10.2) with 1 GB memory its not possible to upload via http a 1 Gb File. Thats no limit problem on my php config. i can look the mem stats when uploading and the growing tmp file. If the temp file has 900 MB, Main Memory free is 0 and the script aborts and php deletes the tmp file. Why don't php use swap memory ? Greets Tom After reading this thread, I would like to add my thoughts. What Apache starts, it reads the PHP memory limits in to the running Apache process. When you try and upload a file, it is a straight HTTP upload. PHP plays no part in the actual upload, except for the upload limits set in place by the php settings found in the php.ini or other Apache config files. Now, Apache actually handles the Upload. Once the file has been received completely, Apache then passes the file and process running to PHP. I have never seen a case where Apache has stored the file on the file system. In my past experience it has always held the file in memory, therefor limited to the max physical memory that was install, minus a little for other things. I have worked on Debian (potato|woody|sarge), Redhat 5.0 - 9, Fedora 1 - 7, OpenBSD 3.6-current, and older versions of NetBSD and FreeBSD. I have also frequented a number of friends installs and I have never seen uploads happen any other way. Nor have I heard of uploads happening any other way. Just my 2cents :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Luke Slater