note 39607 deleted from function.move-uploaded-file by irchtml
| From: | irchtml@php.net | Date: | Thu, 26 Feb 2004 10:54:54 +0000 |
| Subject: | note 39607 deleted from function.move-uploaded-file by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65790@lists.php.net to get a copy of this message | ||
Note Submitter: Kev P
----
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