Re: [PHP] $_FILES doesn't work but $_POST works
On 5/31/06, kartikay malhotra [EMAIL PROTECTED] wrote: However, with Mbuni MMS Gateway (which provides HTTP POST), the above condition in if loop isn't satisfied. I think $_FILES isn't working. However the following code works: ?php $in='/usr/share/wallpapers/alien-night.jpg'; $out='/tmp/alien.jpg'; if(isset($_POST['userfile'])/* || $_FILES['userfile']['size'] 0*/ ) { $f=fopen($out,'a'); echo HEL; copy($in, $out); } ? This implies, $_POST works, and a file has been uploaded. I however, do not know how to access it Have you tried simply saving $_POST['userfile'] to a file? Rabin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_FILES doesn't work but $_POST works
Thanks for your replies. 1. Did you put the enctype=multipart/form-data into the FORM tag? Ans: I do not have a form! I'm using a gateway utility to upload files From documentation of Mbuni MMS gateway: post-url Response content is obtained as result of sending a HTTP POST request to the provided URL. The POST message is *always* encoding (such as that used by a web browser when an HTML form has the submitted using the multipart/form-dataenctype=multipart/form-data parameter set). If http-post-parameters field is given (see below), then the relevant parameters are sent as part of the request. *X-Mbuni* headers are sent as well. http-post-parameters Used in conjunction with post-url. Parameters are provided in the same way as would be provided in an HTTP GET request (e.g. * message=truemyname=testimage=%i*). 2. Have you tried simply saving $_POST['userfile'] to a file? $save = $_POST['userfile']; $f=fopen($out,'a'); copy($save, $out); Nothing is copied. Opened file is empty. Pls suggest KM On 5/31/06, Rabin Vincent [EMAIL PROTECTED] wrote: On 5/31/06, kartikay malhotra [EMAIL PROTECTED] wrote: However, with Mbuni MMS Gateway (which provides HTTP POST), the above condition in if loop isn't satisfied. I think $_FILES isn't working. However the following code works: ?php $in='/usr/share/wallpapers/alien-night.jpg'; $out='/tmp/alien.jpg'; if(isset($_POST['userfile'])/* || $_FILES['userfile']['size'] 0*/ ) { $f=fopen($out,'a'); echo HEL; copy($in, $out); } ? This implies, $_POST works, and a file has been uploaded. I however, do not know how to access it Have you tried simply saving $_POST['userfile'] to a file? Rabin
Re: [PHP] $_FILES doesn't work but $_POST works
On 5/31/06, kartikay malhotra [EMAIL PROTECTED] wrote: Thanks for your replies. 1. Did you put the enctype=multipart/form-data into the FORM tag? Ans: I do not have a form! I'm using a gateway utility to upload files From documentation of Mbuni MMS gateway: post-url Response content is obtained as result of sending a HTTP POST request to the provided URL. The POST message is *always* encoding (such as that used by a web browser when an HTML form has the submitted using the multipart/form-dataenctype=multipart/form-data parameter set). If http-post-parameters field is given (see below), then the relevant parameters are sent as part of the request. *X-Mbuni* headers are sent as well. http-post-parameters Used in conjunction with post-url. Parameters are provided in the same way as would be provided in an HTTP GET request (e.g. * message=truemyname=testimage=%i*). 2. Have you tried simply saving $_POST['userfile'] to a file? $save = $_POST['userfile']; $f=fopen($out,'a'); copy($save, $out); Files don't go into $_POST - they go into $_FILES. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_FILES doesn't work but $_POST works
On 5/31/06, chris smith [EMAIL PROTECTED] wrote: On 5/31/06, kartikay malhotra [EMAIL PROTECTED] wrote: 2. Have you tried simply saving $_POST['userfile'] to a file? $save = $_POST['userfile']; $f=fopen($out,'a'); copy($save, $out); Files don't go into $_POST - they go into $_FILES. Yes, his problem is that the $_FILES is not being set, but there is some value in $_POST['userfile']. Kartikay, I was suggesting that $_POST['userfile'] may contain the file itself, not a filename. What does $_POST['userfile'] contain? Try var_dump()ing it. Rabin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_FILES doesn't work but $_POST works
Did you put the enctype=multipart/form-data into the FORM tag? What you describe matches not doing that. On Wed, May 31, 2006 12:25 am, kartikay malhotra wrote: Hi All, I'm using Mbuni MMS gateway, which provides me the facility to upload .mms files. Now with my little exposure to PHP, to upload files (say from the browser), I use $_POST, namely: if($_FILES['userfile']['size'] 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; ... ... } However, with Mbuni MMS Gateway (which provides HTTP POST), the above condition in if loop isn't satisfied. I think $_FILES isn't working. However the following code works: ?php $in='/usr/share/wallpapers/alien-night.jpg'; $out='/tmp/alien.jpg'; if(isset($_POST['userfile'])/* || $_FILES['userfile']['size'] 0*/ ) { $f=fopen($out,'a'); echo HEL; copy($in, $out); } ? This implies, $_POST works, and a file has been uploaded. I however, do not know how to access it How to access the uploaded file, determine its size and save its contents in a database? Thanks in advance KM -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_FILES doesn't work but $_POST works
kartikay malhotra wrote: Hi All, I'm using Mbuni MMS gateway, which provides me the facility to upload .mms files. Now with my little exposure to PHP, to upload files (say from the browser), I use $_POST, namely: if($_FILES['userfile']['size'] 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; ... ... } That's not $_POST. That's $_FILES. Show us the real code you're using. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php