note 19111 added to features.file-upload
| From: | timtorte at gmx dot net | Date: | Sat, 16 Feb 2002 00:01:49 +0000 |
| Subject: | note 19111 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26683@lists.php.net to get a copy of this message | ||
Using PHP 4.0.6 (of my hosting provider).
I had to change that "handleupload"-function like this to get it to work:
function handleupload() {
global $HTTP_POST_FILES;
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
{
$filename = $HTTP_POST_FILES['userfile']['tmp_name'];
print "$filename was uploaded successfuly";
$realname = $HTTP_POST_FILES['userfile']['name'];
print "realname is $realname";
print "copying file to uploads dir";
copy($HTTP_POST_FILES['userfile']['tmp_name'],
"/place/to/put/".$realname);
}
else
{
echo "Possible file upload attack: filename" .
$_FILES['userfile']['name'] . ".<br>";
}
}
That array "$HTTP_POST_FILES" did not seem to be in scope? The variable
"$_FILES" did not contain any value (empty) - using "$HTTP_POST_FILES" instead.
--
http://www.php.net/manual/en/features.file-upload.php
http://master.php.net/manage/user-notes.php?action=edit+19111
http://master.php.net/manage/user-notes.php?action=delete+19111
http://master.php.net/manage/user-notes.php?action=reject+19111