note 94973 deleted from features.file-upload.post-method by philip
| From: | philip@php.net | Date: | Wed, 27 Apr 2016 22:03:52 +0000 |
| Subject: | note 94973 deleted from features.file-upload.post-method by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205375@lists.php.net to get a copy of this message | ||
Note Submitter: michael
----
Just a little note, when I was trying to get this to work on my webserver I got error telling me the
permissions were wrong, I checked and couldn't see anything wrong then I thought to try
"./" for my upload directory instead of the full address which was something like
"home/username/public_html/uploaddir". This will save it in the same directory as your
script for the program above thats something like
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = './';//<----This is all I changed
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
I know something trivial but when your new to this, those kind of things elude you.