note 64018 added to function.move-uploaded-file
| From: | jessy dot diamondman at gmail dot com | Date: | Wed, 05 Apr 2006 16:29:54 +0000 |
| Subject: | note 64018 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107391@lists.php.net to get a copy of this message | ||
I am pretty new, and am having upload problems myself, but I think I can help out ffproberen2 at
dodgeit dot com with his premission denied errors. I had these two, and I had to change the upload
directory, not the tmp_upload_dir or what ever it is called. The move_uploaded_file meathod takes an
upload location as the last parameter. I am running a bundled package of Apache, Php, mySQL and so
on, and on mine, specifing a directory of '' will upload it into C:\Program
Files\xampp\apache (my PC is my experimental server, I will get linux, but got to obtain it and
internet cuts off after 196mb so can't download it) even though php file is in C:\Program
Files\xampp\htdocs\xampp\jessyexum\upload_client.php.
This is a code that I found and then modified, hope it can help. It dosn't always upload every
file type giving me an error #2.
<?php
$uploaddir = '';
$uploadfile = $uploaddir . basename($_FILES['upfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['upfile']['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>";
?>
----
Server IP: 64.71.164.2
Probable Submitter: 67.142.130.40
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- http://master.php.net/note/edit/64018
Del: integrated -- http://master.php.net/note/delete/64018/integrated
Del: useless -- http://master.php.net/note/delete/64018/useless
Del: bad code -- http://master.php.net/note/delete/64018/bad+code
Del: spam -- http://master.php.net/note/delete/64018/spam
Del: non-english -- http://master.php.net/note/delete/64018/non-english
Del: in docs -- http://master.php.net/note/delete/64018/in+docs
Del: other reasons-- http://master.php.net/note/delete/64018
Reject -- http://master.php.net/note/reject/64018
Search -- http://master.php.net/manage/user-notes.php