Re: [NEWBIE] Trying to create a function from an existing script

From: Date: Fri, 28 Jan 2005 09:27:49 +0000
Subject: Re: [NEWBIE] Trying to create a function from an existing script
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-207565@lists.php.net to get a copy of this message
Jon, As recommended before, I have added "global $HTTP_POST_FILES;" to my function. The upload directory has a permission setting of 777 and the directory specified ends in a slash.I don't know what the server logs say, however, as I don't know where they are or how to check them. I am, after all, a PHP newbie. But I should mention that the script works perfectly when I use this syntax: if( copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir. "imagefile.jpg") However, I wanted to change it to use move_uploaded_file() instead of copy() because Marek suggested it would be more secure that way. So because the script stops working when I switch copy() for move_uploaded_file(), I feel it's a safe bet that the error is somehow in the syntax of the move_uploaded_file() command. Again, for reference, here is the whole if() statement: if(move_uploaded_file($_HTTP_POST_FILES['upfile']['tmp_name'],rawurlencode($store_dir. "imagefile.jpg"))) { echo("Uploaded ".$HTTP_POST_FILES['upfile']['name']." successfully."); } // If the copy function fails output a message. else { echo("Upload of ".$HTTP_POST_FILES['upfile']['name']." to ".$store_dir." failed."); } -- Dave Gutteridge dave@tokyocomedy.com

« previous php.general (#207565) next »