note 39607 added to function.move-uploaded-file
| From: | KevP at rn2 dot php dot net | Date: | Wed, 04 Feb 2004 12:45:28 +0000 |
| Subject: | note 39607 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64630@lists.php.net to get a copy of this message | ||
The following code takes a posted file from a html page and saves it to a folder on a server called
upload
<?
if(!empty($HTTP_POST_FILES["userfile"])) {
$uploaddir = "/upload/"; // set this to wherever
$uploadfrom = $HTTP_POST_FILES["userfile"]["tmp_name"];
$uploaddir += $HTTP_POST_FILES["userfile"]["name"];
//copy the file to some permanent location
if(move_uploaded_file($uploadfrom, $uploaddir)) {
echo("file uploaded");
} else {
echo ("error!");
}
}
?>
The problem is that the server is very secure and this method is disabled. Is there a way of passing
my username and password details for the server in the move_uploaded_file method.
For example when i use an FTP package i have write access to the server. Is this the same when
running a script or is it possible to give myself write access to the upload directory from a php
script
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39607
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39607&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39607&report=yes
Search -- http://master.php.net/manage/user-notes.php