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

From: Date: Fri, 23 Aug 2002 23:55:18 +0000
Subject: Re: Upload file - $HTTP_POST_FILES empty (thinking in harakiri)
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-113874@lists.php.net to get a copy of this message
On Fri, 23 Aug 2002, Juan Pablo Aqueveque wrote: > OK > I get the Warning message on the line 19,28 y 28: > "Warning: Undefined index: userfile" Weird. OK, I've included a short script which should move the uploaded file into place. I copied the locations you provided in your script, but added additional error checking. Try it and let's see what error messages pop out. -- Robert -- ------------------------------------------------------------------ Robert James Kaes --- Flarenet Inc. --- (519) 426-3782 http://www.flarenet.com/ * Putting the Service Back in Internet Service Provider * ------------------------------------------------------------------

<html> <head> <title>Upload Page 2</title> </head> <body> <?php // Enable full debugging information error_reporting(E_ALL); // Make sure the $_FILES array is not empty if (empty($_FILES)) { echo "\$_FILES is empty<br>\n"; } // Create an alias to make typing easier $uploaded_file = &$_FILES['userfile']['tmp_name']; // Check to see if the file was uploaded successfully if (is_uploaded_file($uploaded_file) === true) { // Try and move the uploaded file into it's final location $file_upload_ok = move_uploaded_file($uploaded_file, "./fotos/" . $_FILES['userfile']['name']); if ($file_upload_ok === false) { die("Could not upload the file: " . $_FILES['userfile']['name'] . "<br>\n"); } else { echo "File was uploaded successfully."; } } else { // This occurs if an invalid file was uploaded die("Possible file upload attack. Filename: " . $_FILES['userfile']['name'] . "<br>\n"); } ?> </body> </html>
« previous php.general (#113874) next »