Re: $_FILES doesn't work but $_POST works

From: Date: Wed, 31 May 2006 11:04:40 +0000
Subject: Re: $_FILES doesn't work but $_POST works
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-237139@lists.php.net to get a copy of this message
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=true&myname=test&image=%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 <rabin@rab.in> wrote:
On 5/31/06, kartikay malhotra <kartikay.malhotra@gmail.com> 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 "HELOOOOOOOOOOOOOOOOOOOO"; 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


« previous php.general (#237139) next »