Re: can't upload files
| From: | heinisch at creaction dot de | Date: | Wed, 15 May 2002 13:18:41 +0000 |
| Subject: | Re: can't upload files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97709@lists.php.net to get a copy of this message | ||
At 15.05.2002 12:33, you wrote:
I am using this script: to upload a picture file and I get the error below: "Unable to create 'hgh6.gif': Permission denied in /home/vhtdocs/archipro/do_upload.php on line 13 Couldn't copy the file!" - What am I doing wrong <form enctype="multipart/form-data" method="post" action="do_upload.php"> <p><strong>File to Upload:</strong><br> <input type="file" name="img1" size="30"></p> <P><input type="submit" name="submit" value="Upload File"></p> </form> upload file: <? // if $img_name isn't empty, try to copy the fileYou files name is in the var $img1, your refering to $img1_name !!
if ($img1_name != "") {
copy("$img1", "/images/$img1_name")
you should use absolute pathes
copy("/tmp/".$img1,"/home/yourpath_to_virt_server/images/".$img_name)
or die("Couldn't copy the file!"); } else { // if $img_name was empty, die and let us know why die("No input file specified"); } ?> Warning: Unable to create 'hgh6.gif': Permission denied in /home/vhtdocs/archipro/do_upload.php on line 13 Couldn't copy the file! HTH Oliver