The directory must exists prior to copy, and must be writeable by the server process.
Also note this is a filesystem path.

Pushpinder Sngh Garcha wrote:

Hi

I am trying to upload a file using php.
This is the code that I am using for the php script called "upload.php"

<html>
<?
if(!empty($userfile)) {

//copy the file to some permanent location
copy($userfile, "/upload/myfile.txt");

//destroy the file
unlink($userfile);

//display message
echo("file uploaded");
}
?>
</html>



This is my html page that calls the script

<html>

<form action="upload.php" method=post enctype="multipart/form-data">
submit this file: <input type=file name="userfile"><br>
<input type=submit><br>
</form>
</html>


I am creating a directory called "upload" in the website.

When I run the script I get this error:

"Warning: Unable to create '/upload/myfile.txt': No such file or directory in /home/MATmas/upload.php on line 5
file uploaded Hi There ! "


Please help me out..

--Pushpinder




Pushpinder Singh Garcha
_________________________________
Web Developer
T. Falcon Napier and Associates, Inc.
Off : 704 987 6500
Cell : 704 236 2939
Fax : 704 987 5002
_________________________________



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to