[PHP] xslt extension unable to find files (Php 4.2.0, Windows 95)
Hello, I am using php 4.2.0 and apache 2.0 on win95. I am facing some problems with xslt extension. Noone replied at [EMAIL PROTECTED] Problem is that xslt processor is unable to find the xml and xsl files. Files are in the same directory as the php file and document_root is e:\wwwroot\newsite. So when I do something like: // $proc = xslt_create(); xslt_process($proc, "ptable.xml", "ptable.xsl", "ptable.html"); It tries to find file under some other directory: /// Warning: Sablotron error on line none: cannot open file 'D:/WINDOWS/SYSTEM/inetsrv/ptable.xsl' in E:\web\newsite\transxml.php on line 17 // But readfile("ptable.xml"); is able to read the file and display its contents. Then I changed file paths like this: / xslt_process($proc, "\ptable.xml", "\ptable.xsl", "\ptable.html"); / and it searched for files under d:\. So, I copied both files under d:\ and transformation worked and ptable.html was created. But because I wanted these files to be in the original directory I changed it like this: / $xml_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xml"; $xsl_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xsl"; $html_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.html"; echo $xml_file, ""; echo $xsl_file, ""; echo $html_file, ""; $proc = xslt_create(); if (xslt_process($proc, $xml_file, $xsl_file, $html_file)) { echo "File ptable.xml has been transformed using ptable.xsl"; echo "Contents of this file are:"; readfile("ptable.html"); } else { echo "Some error occured"; echo "Error is: ", xslt_error($proc); echo "Error number is: ", xslt_errno($proc); } xslt_free($proc); // Result is: // E:\web\newsite\ptable.xml E:\web\newsite\ptable.xsl E:\web\newsite\ptable.html Warning: Sablotron error on line 1: unknown encoding '' in E:\web\newsite\transxml.php on line 22 Some error occured Error is: unknown encoding '' Error number is: 66 But there is no encoding problem etc. because it created output file when files were copied to d:\ as mentioned above. Sukhwinder Singh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xslt extension unable to find files on windows 95
Hello, I am using php 4.2.0 and apache 2.0 on win95. I am facing some problems with xslt extension. Nobody replied at [EMAIL PROTECTED] Problem is that xslt processor is unable to find the xml and xsl files. Files are in the same directory as the php file and document_root is e:\wwwroot\newsite. So when I do something like: // $proc = xslt_create(); xslt_process($proc, "ptable.xml", "ptable.xsl", "ptable.html"); It tries to find file under some other directory: /// Warning: Sablotron error on line none: cannot open file 'D:/WINDOWS/SYSTEM/inetsrv/ptable.xsl' in E:\web\newsite\transxml.php on line 17 // But readfile("ptable.xml"); is able to read the file and display its contents. Then I changed file paths like this: / xslt_process($proc, "\ptable.xml", "\ptable.xsl", "\ptable.html"); / and it searched for files under d:\. So, I copied both files under d:\ and transformation worked and ptable.html was created. But because I wanted these files to be in the original directory I changed it like this: / $xml_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xml"; $xsl_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.xsl"; $html_file = stripslashes($_SERVER["DOCUMENT_ROOT"])."\ptable.html"; echo $xml_file, ""; echo $xsl_file, ""; echo $html_file, ""; $proc = xslt_create(); if (xslt_process($proc, $xml_file, $xsl_file, $html_file)) { echo "File ptable.xml has been transformed using ptable.xsl"; echo "Contents of this file are:"; readfile("ptable.html"); } else { echo "Some error occured"; echo "Error is: ", xslt_error($proc); echo "Error number is: ", xslt_errno($proc); } xslt_free($proc); // Result is: // E:\web\newsite\ptable.xml E:\web\newsite\ptable.xsl E:\web\newsite\ptable.html Warning: Sablotron error on line 1: unknown encoding '' in E:\web\newsite\transxml.php on line 22 Some error occured Error is: unknown encoding '' Error number is: 66 But there is no encoding problem etc. because it created output file when files were copied to d:\ as mentioned above. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Upload - post_max_size and upload_max_filesize in GBs
Hello, I want to allow uploading of huge video files, which may be as big as 4 GB. But when I try to set post_max_size = 4G upload_max_filesize = 4G in php.ini, it doesn't work and everything in post (posted data) is ignored. I get a warning about size of posted data greater than some negative number. I read somewhere that php stores this data in integer. I have tested it on 64 bit system (php 5.1.6 installed on Mandriva 2007.0) as well as 32 bit system (php 5.2.2 installed on windows xp sp2). Value up to, I think, 2147483647 bytes or ( around 1.999.. gb) works We need to allow uploading of 4 GB files. Is there any solution. Regards, Sukhwinder Singh
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
Thanks for your reply. So you are saying I cannot do it using php. These files have to be uploaded locally but using web interface and I have to pass some parameters along with file upload to update the database after upload is successful. Also I have to rename the file after it is uploaded. Any utility which allows this? Thanks, Sukhwinder Singh - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 07, 2007 8:35 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: I want to allow uploading of huge video files, which may be as big as 4 GB. But when I try to set post_max_size = 4G upload_max_filesize = 4G in php.ini, it doesn't work and everything in post (posted data) is ignored. I get a warning about size of posted data greater than some negative number. I read somewhere that php stores this data in integer. I have tested it on 64 bit system (php 5.1.6 installed on Mandriva 2007.0) as well as 32 bit system (php 5.2.2 installed on windows xp sp2). Value up to, I think, 2147483647 bytes or ( around 1.999.. gb) works We need to allow uploading of 4 GB files. Is there any solution. Yeah, don't use HTTP. Seriously, HTTP is a crappy mechanism for uploading files, especially large ones. And by large ones I mean >~20MB!! You need to look into maybe a java applet, or just plain FTP/SFTP/SCP for files that big. HTTP was never designed to handle uploading files of that size. For a start there is no facility to restart the upload should it get interrupted and fail. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
Rumor has it that uploaded files are stored in memory before being committed to disk. If so, the amount of free RAM available to PHP would be the limit to the filesize regardless of the ini file settings. I don't think that is the case. File is written to temp directory as it is uploaded. And the qeustion is of php having negative values after I specify post size limit to 4G You should probably use another method of transport for files that large. FTP immediately comes to mind. You mean ftp client? Like cute ftp. If yes, the problem is that along with uploading the file I also have to update database to associate that file with some user etc. It needs to be web based. Sukhwinder Singh - Original Message - From: "Jim Moseby" <[EMAIL PROTECTED]> To: "'Sukhwinder Singh'" <[EMAIL PROTECTED]>; Sent: Thursday, June 07, 2007 8:52 PM Subject: RE: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Hello, I want to allow uploading of huge video files, which may be as big as 4 GB. But when I try to set post_max_size = 4G upload_max_filesize = 4G in php.ini, it doesn't work and everything in post (posted data) is ignored. I get a warning about size of posted data greater than some negative number. I read somewhere that php stores this data in integer. I have tested it on 64 bit system (php 5.1.6 installed on Mandriva 2007.0) as well as 32 bit system (php 5.2.2 installed on windows xp sp2). Value up to, I think, 2147483647 bytes or ( around 1.999.. gb) works We need to allow uploading of 4 GB files. Is there any solution. Regards, Sukhwinder Singh Rumor has it that uploaded files are stored in memory before being committed to disk. If so, the amount of free RAM available to PHP would be the limit to the filesize regardless of the ini file settings. You should probably use another method of transport for files that large. FTP immediately comes to mind. JM -- 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] File Upload - post_max_size and upload_max_filesize in GBs
A beeter method is to send the file via ftp. I think most browsers allow this. And for example store the file in a user specific file. Then the user, via a web interface, select the file it has uploaded and do the rest of the operations you need. Along with uploading the file I also have to pass other information to update the database to associate that file with some user etc. What kind of ftp method you are suggesting? Sukhwinder Singh - Original Message - From: "jose javier parra sanchez" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Sent: Thursday, June 07, 2007 8:59 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs A beeter method is to send the file via ftp. I think most browsers allow this. And for example store the file in a user specific file. Then the user, via a web interface, select the file it has uploaded and do the rest of the operations you need. 2007/6/7, Sukhwinder Singh <[EMAIL PROTECTED]>: Thanks for your reply. So you are saying I cannot do it using php. These files have to be uploaded locally but using web interface and I have to pass some parameters along with file upload to update the database after upload is successful. Also I have to rename the file after it is uploaded. Any utility which allows this? Thanks, Sukhwinder Singh - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 07, 2007 8:35 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs > Sukhwinder Singh wrote: >> I want to allow uploading of huge video files, which may be as big as >> 4 >> GB. But when I try to set post_max_size = 4G >> upload_max_filesize = 4G >> >> in php.ini, it doesn't work and everything in post (posted data) is >> ignored. >> >> I get a warning about size of posted data greater than some negative >> number. >> >> I read somewhere that php stores this data in integer. >> >> I have tested it on 64 bit system (php 5.1.6 installed on Mandriva >> 2007.0) as well as 32 bit system (php 5.2.2 installed on windows xp >> sp2). >> >> Value up to, I think, 2147483647 bytes or ( around 1.999.. gb) works >> >> We need to allow uploading of 4 GB files. Is there any solution. > > Yeah, don't use HTTP. Seriously, HTTP is a crappy mechanism for > uploading > files, especially large ones. And by large ones I mean >~20MB!! > > You need to look into maybe a java applet, or just plain FTP/SFTP/SCP > for > files that big. HTTP was never designed to handle uploading files of > that > size. For a start there is no facility to restart the upload should it > get > interrupted and fail. > > -Stut > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
I would hazard a guess that you're overflowing a signed 32-bit int by specifying 4gig, but I could be wrong. It's certainly not the issue. Yes you are right. That is what is happening. Sukhwinder Singh - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: "Jim Moseby" <[EMAIL PROTECTED]>; Sent: Thursday, June 07, 2007 9:16 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: Rumor has it that uploaded files are stored in memory before being committed to disk. If so, the amount of free RAM available to PHP would be the limit to the filesize regardless of the ini file settings. I don't think that is the case. File is written to temp directory as it is uploaded. And the qeustion is of php having negative values after I specify post size limit to 4G I would hazard a guess that you're overflowing a signed 32-bit int by specifying 4gig, but I could be wrong. It's certainly not the issue. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
Sounds like you need a Java applet. I have little experience with this, but I know that quite a few exist. I have no idea if any of them support sending meta data with the upload. I suggest you start Googling. Even java applets have to hand over the file to some script, in this case php and php will get it in $_FILES array it seems (in case of japplet). so the problem will remain. - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 07, 2007 8:56 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: Thanks for your reply. So you are saying I cannot do it using php. These files have to be uploaded locally but using web interface and I have to pass some parameters along with file upload to update the database after upload is successful. Also I have to rename the file after it is uploaded. Any utility which allows this? Sounds like you need a Java applet. I have little experience with this, but I know that quite a few exist. I have no idea if any of them support sending meta data with the upload. I suggest you start Googling. -Stut - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 07, 2007 8:35 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: I want to allow uploading of huge video files, which may be as big as 4 GB. But when I try to set post_max_size = 4G upload_max_filesize = 4G in php.ini, it doesn't work and everything in post (posted data) is ignored. I get a warning about size of posted data greater than some negative number. I read somewhere that php stores this data in integer. I have tested it on 64 bit system (php 5.1.6 installed on Mandriva 2007.0) as well as 32 bit system (php 5.2.2 installed on windows xp sp2). Value up to, I think, 2147483647 bytes or ( around 1.999.. gb) works We need to allow uploading of 4 GB files. Is there any solution. Yeah, don't use HTTP. Seriously, HTTP is a crappy mechanism for uploading files, especially large ones. And by large ones I mean >~20MB!! You need to look into maybe a java applet, or just plain FTP/SFTP/SCP for files that big. HTTP was never designed to handle uploading files of that size. For a start there is no facility to restart the upload should it get interrupted and fail. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
Even java applets have to hand over the file to some script, in this case php and php will get it in $_FILES array it seems (in case of japplet). so the problem will remain. Not at all true. A Java applet can use FTP to handle the upload and still pass meta data about the file as an HTTP POST request. There is no requirement to use HTTP to upload the file from a Java applet. It is not about how data is going to be transferred but it is about php having a limit on what it can accept as POST. But we'll see how it works out. I'll let everyone know. I am trying japplet for now. Thanks for replying. Sukhwinder Singh - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Friday, June 08, 2007 1:28 AM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: Sounds like you need a Java applet. I have little experience with this, but I know that quite a few exist. I have no idea if any of them support sending meta data with the upload. I suggest you start Googling. Even java applets have to hand over the file to some script, in this case php and php will get it in $_FILES array it seems (in case of japplet). so the problem will remain. Not at all true. A Java applet can use FTP to handle the upload and still pass meta data about the file as an HTTP POST request. There is no requirement to use HTTP to upload the file from a Java applet. -Stut - Original Message ----- From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 07, 2007 8:56 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: Thanks for your reply. So you are saying I cannot do it using php. These files have to be uploaded locally but using web interface and I have to pass some parameters along with file upload to update the database after upload is successful. Also I have to rename the file after it is uploaded. Any utility which allows this? Sounds like you need a Java applet. I have little experience with this, but I know that quite a few exist. I have no idea if any of them support sending meta data with the upload. I suggest you start Googling. -Stut ----- Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Thursday, June 07, 2007 8:35 PM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: I want to allow uploading of huge video files, which may be as big as 4 GB. But when I try to set post_max_size = 4G upload_max_filesize = 4G in php.ini, it doesn't work and everything in post (posted data) is ignored. I get a warning about size of posted data greater than some negative number. I read somewhere that php stores this data in integer. I have tested it on 64 bit system (php 5.1.6 installed on Mandriva 2007.0) as well as 32 bit system (php 5.2.2 installed on windows xp sp2). Value up to, I think, 2147483647 bytes or ( around 1.999.. gb) works We need to allow uploading of 4 GB files. Is there any solution. Yeah, don't use HTTP. Seriously, HTTP is a crappy mechanism for uploading files, especially large ones. And by large ones I mean >~20MB!! You need to look into maybe a java applet, or just plain FTP/SFTP/SCP for files that big. HTTP was never designed to handle uploading files of that size. For a start there is no facility to restart the upload should it get interrupted and fail. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
You don't appear to have read what I said. A Java applet can use FTP to upload the file - PHP does not get involved in that part. Once the upload is complete the applet can POST to your PHP file giving it information like where it's put the file and this other information you need to give it so it can rename the file. This is the only bit PHP gets involved in and it doesn't involve trying to upload 4 gig over a machanism that was never designed for it. Thanks again for replying. I have read. I have been trying to find out way for last two days. I can say about jupload and how it seems to work. It uploads file to server in a temporary directory. It has postURL parameter. Then it POSTS the data to php file. Because it POSTS, the php configuration values comes into question. Here is an example: Settings in php.ini are 50M for upload_max_fisesize and 50M for post_max_size. I used japplet and uploaded a 51.89 MB file. This is what is in error log. [08-Jun-2007 03:06:29] PHP Warning: POST Content-Length of 54414946 bytes exceeds the limit of 52428800 bytes in Unknown on line 0 [08-Jun-2007 03:06:29] PHP Notice: Undefined index: File0 in E:\projects\ice\post_test.php on line 13 File0 is the first file in $_FILES array, as POST fails I don't get that array. I uploaded a 48 MB file and it worked without any problem. Sukhwinder Singh - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: Sent: Friday, June 08, 2007 2:10 AM Subject: Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: Even java applets have to hand over the file to some script, in this case php and php will get it in $_FILES array it seems (in case of japplet). so the problem will remain. Not at all true. A Java applet can use FTP to handle the upload and still pass meta data about the file as an HTTP POST request. There is no requirement to use HTTP to upload the file from a Java applet. It is not about how data is going to be transferred but it is about php having a limit on what it can accept as POST. But we'll see how it works out. I'll let everyone know. I am trying japplet for now. You don't appear to have read what I said. A Java applet can use FTP to upload the file - PHP does not get involved in that part. Once the upload is complete the applet can POST to your PHP file giving it information like where it's put the file and this other information you need to give it so it can rename the file. This is the only bit PHP gets involved in and it doesn't involve trying to upload 4 gig over a machanism that was never designed for it. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs
Sorry but I couldn't follow. If I understood correctly, there's 50M (or 4G, for that matter) data, and there's say 5K metadata. First, java applet uploads the bulk data over ftp to a temp directory on the server (employing the ftp service running on the server - not apache/php). If/when the bulk data transfer completes successfully, then the java applet needs to POST the 5K metadata over http to php. Up to this point I can follow. But in your example, the java applet transfers the bulk data itself -not metadata- a second time, POSTing it to php? Yes you are right. I seems to post complete data. Actually I want 4GB uploads as uploads will be local so it is not going to take so much time. The example of 50 MB I provided was to prove that applet was actually POSTing to php and php's post and upload limits came into effect. I am using JUpload. http://jupload.sourceforge.net/ And it POSTs the data to a php script after it uploads. PHP doesn't seem to allow more than 1.9... GB If so, then the applet you use (or the parameters it's been passed) should be broken, I guess. Any suggestion to use some other applet. Any freeware etc. Or one not so expensive and which overcomes this php's 1.99 gb limit. Sukwhinder Singh - Original Message - From: "Abdullah Ramazanoglu" <[EMAIL PROTECTED]> To: Sent: Friday, June 08, 2007 3:37 AM Subject: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh dedi ki: --8<-- I have read. I have been trying to find out way for last two days. I can say about jupload and how it seems to work. It uploads file to server in a temporary directory. It has postURL parameter. Then it POSTS the data to php file. Because it POSTS, the php configuration values comes into question. Here is an example: Settings in php.ini are 50M for upload_max_fisesize and 50M for post_max_size. I used japplet and uploaded a 51.89 MB file. This is what is in error log. [08-Jun-2007 03:06:29] PHP Warning: POST Content-Length of 54414946 [bytes exceeds the limit of 52428800 bytes in Unknown on line 0 Sorry but I couldn't follow. If I understood correctly, there's 50M (or 4G, for that matter) data, and there's say 5K metadata. First, java applet uploads the bulk data over ftp to a temp directory on the server (employing the ftp service running on the server - not apache/php). If/when the bulk data transfer completes successfully, then the java applet needs to POST the 5K metadata over http to php. Up to this point I can follow. But in your example, the java applet transfers the bulk data itself -not metadata- a second time, POSTing it to php? If so, then the applet you use (or the parameters it's been passed) should be broken, I guess. Kind regards, -- Abdullah Ramazanoglu aramazan ÄT myrealbox D0T cöm -- 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: File Upload - post_max_size and upload_max_filesize in GBs
I will again suggest http://radinks.com/upload/ . It does not use POST to transfer huge files. Thanks everyone for replying. I had a look at that. My problem is that along with uploading file I also have to post some other information as well. File names are randomly generated. Jupload seems to do the work other than that POST problem. Client is asking for web based solution. I cannot ask him to do ftp. PHP's handling of uploaded files is confusing. I have added logging to the script to which jupload posts. Logging suggests that php file is only accessed after file is completely uploaded by jupload. I also checked apache access logs. Entry in apache log appears only after file is completely uploaded. Another thing that came up with this jupload is that as soon as I hit upload button, a file named phpxx.tmp (xx is any number) is created in temporary directory and its size starts growing as upload happens. If applet doesn't post to php even at start then how come the temporary file is named phpxx.tmp. I tried to upload file on internet using jupload and it seems to me script is timing out even when I have specified 1 hour as timeout. set_time_limit(216000); 137 MB upload seemed to time out. and the set_time_limit doesn't seem to have any affect. Now the even if I accept php's 1.99 GB limit. What to do about this timeout? Do I have to set it in php.ini? Why woudn't it work through the above function? Stut is suggesting it has to be custom made as this kind of solution doesn't seem to already exit. A solution where some applet etc. only passes that information to php which is needed to move the file and update the database. Thanks, Sukhwinder Singh - Original Message - From: "Jim Moseby" <[EMAIL PROTECTED]> To: "'Sukhwinder Singh'" <[EMAIL PROTECTED]>; "Abdullah Ramazanoglu" <[EMAIL PROTECTED]> Cc: Sent: Friday, June 08, 2007 5:40 PM Subject: RE: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs Any suggestion to use some other applet. Any freeware etc. Or one not so expensive and which overcomes this php's 1.99 gb limit. I will again suggest http://radinks.com/upload/ . It does not use POST to transfer huge files. JM -- 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: File Upload - post_max_size and upload_max_filesize in GBs
Stut, thank you very much for explaining things and trying to help. The applet *does* POST to PHP. However, it has the option to upload to an FTP server "the choice of using HTTP, HTTPS or FTP connections for your transfer" (from the website). So it seems applet posts complete data to that php file handling script (rather php engine),*as soon as upload button is clicked*, rather than uploading first and then posting to php. That is the reason for name phpxx.tmp of temporary file. As that seems to be the case; there is no real benefit in using applet (in case of http) other than that progress bar which is already supported by php 5.2 It also seems that php engine only hands over control to php file after the file is completely uploaded that is why my custom logging doesn't start as soon as upload starts. It only starts when file is already uploaded. The timeout is likely coming from Apache. It has a limits similar to PHP. Tested on two servers. Both cases it seems to fail if it takes more than 30 seconds. I get an error: [08-Jun-2007 20:15:06] PHP Fatal error: Maximum execution time of 30 seconds exceeded in \handle_upload.php on line 2 If you don't mind me asking, what are people uploading? 4gig is a lot for a single file of any type except maybe DVD images. Is there no way the user can upload several (read lots) smaller files instead of one big one? It is not people that are uploading things. It is admin, and admin is local to server. I won't want to try uploading 4 GB over internet. And yes these are dvd files. They are going to be uploaded for streaming. But along with uploading of files som other fields also have to be uploaded. Client is showing examples like http://www.attachmore.com/Whysubscribe.aspx which claim unlimited upload size. I assume they are using custom activex controls. Looks like I have to post that php's upload limit of 1.99 gb to php internal mailing list. Thanks again, Sukhwinder Singh . - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: "Jim Moseby" <[EMAIL PROTECTED]>; Sent: Friday, June 08, 2007 6:42 PM Subject: Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: PHP's handling of uploaded files is confusing. I have added logging to the script to which jupload posts. Logging suggests that php file is only accessed after file is completely uploaded by jupload. I also checked apache access logs. Entry in apache log appears only after file is completely uploaded. Absolutely correct - the data sent with an HTTP POST will be completely uploaded before the PHP script is started. Likewise, the entry in the apache log will only be done once the request is completed otherwise it doesn't know all the information it needs. Another thing that came up with this jupload is that as soon as I hit upload button, a file named phpxx.tmp (xx is any number) is created in temporary directory and its size starts growing as upload happens. If applet doesn't post to php even at start then how come the temporary file is named phpxx.tmp. The applet *does* POST to PHP. However, it has the option to upload to an FTP server "the choice of using HTTP, HTTPS or FTP connections for your transfer" (from the website). I tried to upload file on internet using jupload and it seems to me script is timing out even when I have specified 1 hour as timeout. set_time_limit(216000); 137 MB upload seemed to time out. and the set_time_limit doesn't seem to have any affect. Now the even if I accept php's 1.99 GB limit. What to do about this timeout? Do I have to set it in php.ini? Why woudn't it work through the above function? The timeout is likely coming from Apache. It has a limits similar to PHP. Stut is suggesting it has to be custom made as this kind of solution doesn't seem to already exit. A solution where some applet etc. only passes that information to php which is needed to move the file and update the database. Indeed, that is what I'm suggesting. However, I *do* think the solution exists, but I've only ever seen it on specific websites. I've never seen a product that can do this sort of thing. If you don't mind me asking, what are people uploading? 4gig is a lot for a single file of any type except maybe DVD images. Is there no way the user can upload several (read lots) smaller files instead of one big one? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs
I think you need to read up on how an HTTP POST request works when it's handled by PHP because some of what you've written there indicates that you don't quite have it. When you hit the upload button the browser makes a connection to the server and the PHP engine gets invoked to handle the request. The engine then reads the entire HTTP request, including the file data that is being uploaded. That temporary file is created by the PHP engine to temporarily store the incoming data. Only when the entire request has been read does the PHP engine start running your PHP script. Yes I didn't know. But I learned by actully experimenting with it and discussing on this mailing list. It is not everyday that you have to deal with such issues. Sites like these calim that you can use your web browser to upload 10 gb files. http://www.sendyourfiles.com/features/?web-mail But clients forget that they are using some kind of plugins. That's the PHP timeout kicking in. There is another setting in php.ini (I forget what it's called) that tells it how long it is allowed to wait for the request to be read, but looking at that error I'm not convinced that's what's causing that timeout. I think what you wanted to write was max_input_time. It's very difficult to tell without seeing your script. My script does nothing more than get the file information, move it and update the database. Looks like I have to post that php's upload limit of 1.99 gb to php internal mailing list. Definitely worth doing, but don't be surprised if you get the same reaction. Yes I expect the same response :-). "Don't upload 4 gb files over http" Thank you very much Stut! - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: "Jim Moseby" <[EMAIL PROTECTED]>; Sent: Friday, June 08, 2007 8:01 PM Subject: Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs Sukhwinder Singh wrote: Stut, thank you very much for explaining things and trying to help. That's no problem, it's what I'm here for (I knew there was a reason). The applet *does* POST to PHP. However, it has the option to upload to an FTP server "the choice of using HTTP, HTTPS or FTP connections for your transfer" (from the website). So it seems applet posts complete data to that php file handling script (rather php engine),*as soon as upload button is clicked*, rather than uploading first and then posting to php. That is the reason for name phpxx.tmp of temporary file. As that seems to be the case; there is no real benefit in using applet (in case of http) other than that progress bar which is already supported by php 5.2 It also seems that php engine only hands over control to php file after the file is completely uploaded that is why my custom logging doesn't start as soon as upload starts. It only starts when file is already uploaded. I think you need to read up on how an HTTP POST request works when it's handled by PHP because some of what you've written there indicates that you don't quite have it. When you hit the upload button the browser makes a connection to the server and the PHP engine gets invoked to handle the request. The engine then reads the entire HTTP request, including the file data that is being uploaded. That temporary file is created by the PHP engine to temporarily store the incoming data. Only when the entire request has been read does the PHP engine start running your PHP script. The timeout is likely coming from Apache. It has a limits similar to PHP. Tested on two servers. Both cases it seems to fail if it takes more than 30 seconds. I get an error: [08-Jun-2007 20:15:06] PHP Fatal error: Maximum execution time of 30 seconds exceeded in \handle_upload.php on line 2 That's the PHP timeout kicking in. There is another setting in php.ini (I forget what it's called) that tells it how long it is allowed to wait for the request to be read, but looking at that error I'm not convinced that's what's causing that timeout. It's very difficult to tell without seeing your script. If you don't mind me asking, what are people uploading? 4gig is a lot for a single file of any type except maybe DVD images. Is there no way the user can upload several (read lots) smaller files instead of one big one? It is not people that are uploading things. It is admin, and admin is local to server. I won't want to try uploading 4 GB over internet. And yes these are dvd files. They are going to be uploaded for streaming. But along with uploading of files som other fields also have to be uploaded. Client is showing examples like http://www.attachmore.com/Whysubscribe.aspx which claim unlimited upload size. I assume they are
Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs
- Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: "Jim Moseby" <[EMAIL PROTECTED]>; ; "Stut" <[EMAIL PROTECTED]> Sent: Friday, June 08, 2007 11:32 PM Subject: Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs On Fri, June 8, 2007 8:58 am, Sukhwinder Singh wrote: I had a look at that. My problem is that along with uploading file I also have to post some other information as well. File names are randomly generated. Jupload seems to do the work other than that POST problem. Client is asking for web based solution. I cannot ask him to do ftp. You are never going to be happy with such large uploads over HTTP, imho. Nor are your users, for several reasons: No way to continue aborted/failed upload, unlike FTP Browser timeout completely outside your control Too many users will think they have to sit and wait to finish Actually only admin will upload files and that to locally. That is why I am not worried about wasting 15 minutes to upload it through browser. PHP's handling of uploaded files is confusing. I have added logging to the script to which jupload posts. Logging suggests that php file is only accessed after file is completely uploaded by jupload. I also checked apache access logs. Entry in apache log appears only after file is completely uploaded. Sort of... You'd have to read Apache and PHP sources to see how it all works for sure, but... Only if I was a C programmer :-). Not even java programmer anymore. Another thing that came up with this jupload is that as soon as I hit upload button, a file named phpxx.tmp (xx is any number) is created in temporary directory and its size starts growing as upload happens. It's entirely possible that Apache and PHP conspire to handle the upload, and do things about the upload, but you won't have any access in php script to it, most likely, until it's all finished. Yes, that is what is happening. That said, check out Rasmus' recent patch to PHP which allows for an upload progress meter -- It's entirely possible you could glean something useful from that... I have my own ajax script. which uses php 5.2 to monitor progress. The problem is php's limit of around 1.99 GB. You have missed few posts. http://www.nabble.com/RE:-File-Upload---post_max_size-and-upload_max_filesize-in--GBs-t3884697.html In my first email I had specified that when I set php limit to 4G it starts complaining about maximum post length (as it becomes negative). It seems to store values in integer or something. Also even apache 2.0 complains about invalid content length when I try to post 4 gb file. I have checked logs. May be apache 2.2 solves this problem. If applet doesn't post to php even at start then how come the temporary file is named phpxx.tmp. It's posting to Apache which is talking to PHP to handle the upload, but it's a "team" process, and your PHP script has zero access until it's done. I tried to upload file on internet using jupload and it seems to me script is timing out even when I have specified 1 hour as timeout. set_time_limit(216000); You have to define "timing out" more clearly... Often-times, a browser will give up, even if the upload is proceeding normally. We cannot fix broken web browsers. No matter how much we'd like to. :-) 137 MB upload seemed to time out. and the set_time_limit doesn't seem to have any affect. Then the timeout isn't coming from PHP, but from another source. Apache may be timing out, a buggy browser may be timing out, the Internet connection may simply not be stable enough for a sustained transfer... Now the even if I accept php's 1.99 GB limit. What to do about this timeout? A 1.99 G limit is probably file-system based... Not file system. I have tried on linux, windows (NTFS). As I explain above about negative numbers of post_max_size. Do I have to set it in php.ini? Why woudn't it work through the above function? You cannot affect file upload in a PHP script, because the upload occurs (or fails to occur) long before your PHP script begins to run -- You can only do it in php.ini or in .htaccess Stut is suggesting it has to be custom made as this kind of solution doesn't seem to already exit. A solution where some applet etc. only passes that information to php which is needed to move the file and update the database. Perhaps you should look at Flikr's application that they implemented for this purpose, or read "Building Scalable Web Sites" by Cal Henderson (of Flikr) Right. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs
Tested on two servers. Both cases it seems to fail if it takes more than 30 seconds. I get an error: [08-Jun-2007 20:15:06] PHP Fatal error: Maximum execution time of 30 seconds exceeded in \handle_upload.php on line 2 That's php timeout message. You have NOT set the tmeout as you think. Yes it is. I had tried setting it using ini_set and also set_time_limit didn't take into consideration any. ini_set('max_execution_time ', 216000); set_time_limit(216000); I had to change in php.ini and it seems to work. Sukhwinder Singh - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]> Cc: "Stut" <[EMAIL PROTECTED]>; "Jim Moseby" <[EMAIL PROTECTED]>; Sent: Friday, June 08, 2007 11:39 PM Subject: Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs On Fri, June 8, 2007 10:17 am, Sukhwinder Singh wrote: Stut, thank you very much for explaining things and trying to help. The applet *does* POST to PHP. However, it has the option to upload to an FTP server "the choice of using HTTP, HTTPS or FTP connections for your transfer" (from the website). So it seems applet posts complete data to that php file handling script (rather php engine),*as soon as upload button is clicked*, rather than uploading first and then posting to php. That is the reason for name phpxx.tmp of temporary file. If it tried to upload and then do a separate POST, then you'd have no way to connect the two events, as HTTP is stateless. Or, rather, you'd need to overlay some kind of protocol on top of HTTP that would maintain the state to tie the upload to the POST. It's not "impossible" but nobody has bothered to do it because HTTP file upload works "okay" for normal uses, and if you have ginormous files, you'll be better off using FTP anyway. But do feel free to write and release an Open Source solution to this problem. Tested on two servers. Both cases it seems to fail if it takes more than 30 seconds. I get an error: [08-Jun-2007 20:15:06] PHP Fatal error: Maximum execution time of 30 seconds exceeded in \handle_upload.php on line 2 That's php timeout message. You have NOT set the tmeout as you think. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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: File Upload - post_max_size and upload_max_filesize in GBs
I think the problem occurred as I specified size in php.ini using 4096M or 4G. Then just now I specified as 4294967294 around 4(GB) and I am getting the POSTed values. *Locally, on windows xp* this is working but when I set these values as as 4294967294 on Mandriva with php 5.1.6 and Apache/2.2.3. I get nothing in post as post_max_size turns negative and it won't allow any content greater than negative value. I am still trying. I Installed Apache 2.2.4 on windows. Now file is being uploaded properly but file was still not moved. I had added a check if ($file_details['size'] > 0) // do moving, update databases and it was being returned negative. The logged it and $_FILES showed this for a 3.28 gb file Array ( [File0] => Array ( [name] => FC-6-i386-DVD.iso [type] => application/octet-stream [tmp_name] => C:\DOCUME~1\ADMINI~1.COM\LOCALS~1\Temp\php77.tmp [error] => 0 [size] => -769771520 ) ) I have removed this file size check and file *Uploaded Successfully*. I haven't changed memory limit at all. Script time out I had to specify in php.ini file as one hour. Even though time of around 6 minutes should be enough to do the move_uploaded_file and update database but set_time_limit had no effect. Any guess upgrading to php 5.2.1 on mandriva will solve problem as it already has apache 2.2.3? Sukhwinder Singh - Original Message - From: "Jim Lucas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Sukhwinder Singh" <[EMAIL PROTECTED]>; "Jim Moseby" <[EMAIL PROTECTED]>; ; "Stut" <[EMAIL PROTECTED]> Sent: Saturday, June 09, 2007 3:55 AM Subject: Re: [PHP] Re: File Upload - post_max_size and upload_max_filesize in GBs Richard Lynch wrote: On Fri, June 8, 2007 4:03 pm, Jim Lucas wrote: afaik, you are using the stock php.ini setting while you are uploading. This should not be taken to mean that if one changes php.ini, that the change does not affect file upload -- it definitely does matter... Not sure Jim meant that Sukhwinder was using stock php.ini, or everybody, but it's definitely not the case that everybody is, like it or not -- If that were true, upload_max_filesize would be meaningless. You CANNOT change the file upload time out with set_time_limit, however, because the file upload happens BEFORE your PHP script begins execution. The time limits affecting file upload can only be set: a. in http.conf, for various Apache settings, if any (off-topic) b. in php.ini or .htaccess b1. you'll need to crank up max_input_time, I think b2. max_execution_time for sure b3. memory_limit while you are at it, probably You of course have to crank up upload_max_filesise to way beyond what you expect for an uploaded file. Don't forget about other php.ini limiters. These are all that I think one would have to adjust to make things work. max_execution_time max_input_time memory_limit post_max_size file_uploads upload_max_filesize Granted, you need to take into account limitations outside of php. ie... available hard drive space any possible hard disk quota limit single file size limit of the OS file size limit of Apache ( mentioned by another replier ) Apache < 2.x is less than 2g Apache 2.x is greater than 2g And there might be more that I am not aware of... -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload - post_max_size and upload_max_filesize in GBs
I think you have to go pretty far back in PHP history (in 'net time) to find that to be true... Not 100% sure, mind you, but pretty sure. I also think that the thing about memory limit is not true these days. I have been able to upload 3.28 gb file with memory limit specified as 128 MB. I also commened about it earlier but was referred to php manual. The manual says that yes, and I head read it myself but didn't increase the memonry and it still worked Sukhwinder Singh - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: "Jim Moseby" <[EMAIL PROTECTED]> Cc: "'Sukhwinder Singh'" <[EMAIL PROTECTED]>; Sent: Saturday, June 09, 2007 5:15 AM Subject: RE: [PHP] File Upload - post_max_size and upload_max_filesize in GBs On Thu, June 7, 2007 10:52 am, Jim Moseby wrote: Rumor has it that uploaded files are stored in memory before being committed to disk. If so, the amount of free RAM available to PHP would be the limit to the filesize regardless of the ini file settings. I think you have to go pretty far back in PHP history (in 'net time) to find that to be true... Not 100% sure, mind you, but pretty sure. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Transparent image resizing using php 4.4.x
I have tried many ways to resize a transparent gif but it works on my local server which has php 5.1.6 but none works using php 4.4.x Also the below works when using imagecopyresized and not imagecopyresampled. I have no clue why that is the case as imagecopyresampled is supposed to produce better results. I have php version 5.1.6 locally (windows) and this works: $img_resized = ImageCreateTrueColor ($img_new_width, $img_new_height); // new image to create $o_img = ImageCreateFromGif($source_file_path); // source file $trans_arr = get_transparency($source_file_path); // function given below if (isset($trans_arr['red']) && isset($trans_arr['green']) && isset($trans_arr['blue'])) { $transparent = imagecolorallocate($img_resized, $trans_arr['red'], $trans_arr['green'], $trans_arr['blue']); imagefilledrectangle($img_resized, 0, 0, $img_new_width, $img_new_height, $transparent); imagecolortransparent($img_resized, $transparent); } // I tried follwoing instead of that get_transparency function and above codee. But same result /*$transparent = imagecolorallocate($img_resized, 255, 255, 255); imagefilledrectangle($img_resized, 0, 0, $img_new_width, $img_new_height, $transparent); imagecolortransparent($img_resized, $transparent); */ imagecopyreresized($img_resized, $o_img, 0 , 0 , 0 , 0, $img_new_width, $img_new_height, $img_orig_width, $img_orig_height); ImageGif($img_resized, $new_file_path); // this function I created by copying code from somewhere on internet function get_transparency($img_file) { $ret = array(); $fp = fopen($img_file, "rb"); $result = fread($fp, 13); $colorFlag = ord(substr($result,10,1)) >> 7; $background = ord(substr($result,11)); if ($colorFlag) { $tableSizeNeeded = ($background + 1) * 3; $result = fread($fp, $tableSizeNeeded); $ret['red'] = ord(substr($result, $background * 3, 1)); $ret['green'] = ord(substr($result, $background * 3 + 1, 1)); $ret['blue'] = ord(substr($result, $background * 3 + 2, 1)); } fclose($fp); return $ret; } ?> But the above doesn't work using php 4.4.x and creates images with lots of white lines/dots in it. Some pixel is transparent and some it isn't. I have no knowedge about image manuplation like alpha channels etc. Could anyone please provide me a solution which works using php 4.4.x Sukhwinder Singh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transparent image resizing using php 4.4.x
try: imagecolortransparent($img,imagecolorat($img,0,0)); Look-up imagecolorat(). I had tried it earlier. As I have written in my other emails. I have tried almost all solutions. I am really wondering that no one has every faced any such problem. I'll try what you have suggested. But I think I have already and it didn't work. But I'll let you know after trying again. Sukhwinder Singh - Original Message - From: "tedd" <[EMAIL PROTECTED]> To: "Sukhwinder Singh" <[EMAIL PROTECTED]>; Sent: Sunday, June 10, 2007 10:08 PM Subject: Re: [PHP] Transparent image resizing using php 4.4.x At 1:12 AM +0500 6/10/07, Sukhwinder Singh wrote: -snip- Could anyone please provide me a solution which works using php 4.4.x Sukhwinder Singh Instead of: imagecolortransparent($img_resized, $transparent); try: imagecolortransparent($img,imagecolorat($img,0,0)); Look-up imagecolorat(). 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