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@xxxxxxxxxxxxxxx
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php