Re: Upload file - $HTTP_POST_FILES empty (thinking in harakiri)

From: Date: Fri, 23 Aug 2002 16:02:07 +0000
Subject: Re: Upload file - $HTTP_POST_FILES empty (thinking in harakiri)
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-113865@lists.php.net to get a copy of this message
OK I get the Warning message on the line 19,28 y 28: "Warning: Undefined index: userfile" -This is my form: <form enctype="multipart/form-data" action="upload_tu_destino.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> - and this is upload_tu_destino.php <? error_reporting(E_ALL); foreach ($_FILES as $key => $val) {
        echo "$key -> $val<br>";
} if ( empty($_FILES ) ) echo "\$_FILES are empty!!!!!<br>\n"; // line 19 if (is_uploaded_file($_FILES ['userfile']['tmp_name'])) {
    copy($_FILES ['userfile']['tmp_name'], "./fotos/".$_FILES ['userfile']['name']);
} else { //line 25 echo "Possible file upload attack. Filename: " . $_FILES ['userfile']['name']; } // line 28 move_uploaded_file($_FILES ['userfile']['tmp_name'], "./fotos/".$_FILES ['userfile']['name']); ?> (BTW, thanks for your time) --jp At 17:50 23-08-2002 -0400, Robert James Kaes wrote:
On Fri, 23 Aug 2002, Juan Pablo Aqueveque wrote: I get the next messages Robert: Warning: Undefined index: userfile in /home/juque/public_html/VI_eaf/upload_tu_destino.php on line 28 line 28: if (is_uploaded_file($HTTP_POST_FILES ['userfile']['tmp_name'])) Well, first off I would not place a space between $HTTP_POST_FILES and ['userfile'] (in other words it should read $HTTP_POST_FILES['userfile']['tmp_name'] or better $_FILES['username']['tmp_name']). Could you post the complete contents of the file which calls the upload_tu_destino.php script. Maybe there is something there which is causing the problem. I would also recommend that you always set error_reporting(E_ALL) when you're developing your scripts. It makes tracking down problems much easier. (You can set error_reporting(0) when you go to production.)
        -- Robert
-- ------------------------------------------------------------------
    Robert James Kaes    ---  Flarenet Inc.  ---    (519) 426-3782
                       http://www.flarenet.com/
      * Putting the Service Back in Internet Service Provider *
------------------------------------------------------------------
________________________________________________________ Juan Pablo Aqueveque <juque@uct.cl> Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628

« previous php.general (#113865) next »