note 69303 deleted from function.is-uploaded-file by betz
| From: | betz@php.net | Date: | Thu, 31 Aug 2006 03:09:15 +0000 |
| Subject: | note 69303 deleted from function.is-uploaded-file by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116528@lists.php.net to get a copy of this message | ||
Note Submitter: Vinay Nagrik
----
Dear group members,
I want to upload a file onto the server but don't want to use the help
of forms. I want to do the
same from opening the conenction from command line and do everything
from there on.
Here is my header info
POST /fileupload.php HTTP/1.1
User-Agent: Mozilla/5.0
Host: xx.xx.xx.xx
Accept:
text/xml,application/xml,application/xhtml+xml,
text/html;q=0.9,text/plain;qÂ=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Disposition: attachment; userfile=A.h
Content-length: 81
Where fileupad.php looks like ******************
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used
instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$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>";
?>
******************************************************
What I noticed that the association between variable "userfile" defined in
Content-Disposition
header and the variable "usrfile" in the php script does not get created.
Can someone help me in creating this association or pointing out the missing step.\
Thanks in advance.
nagrik