Page 1 of 1

copy(productImages/submitbutton.png) [function.copy]: failed

Posted: Thu Jun 19, 2003 12:50 pm
by mikesheridan5
I am getting this error when uploading a file

copy(productImages/submitbutton.png) [function.copy]: failed to create stream: Permission denied in

i am on a linux server with mysql

here is some of my code
if (@is_uploaded_file($_FILES["userfile"]["tmp_name"]))
{
copy($_FILES["userfile"]["tmp_name"], "productImages/" . $_FILES["userfile"]["name"]);
echo "<p>File uploaded successfully.</p><br>";
$image_path = $_FILES["userfile"]["name"];

Any suggestions???? any help would be greatly appreciated

Thanks! :idea:

Posted: Thu Jun 19, 2003 12:56 pm
by cactus
The place where you are copying the file to is owned by another user or you don't have sufficent permissions to write to it, "chown" the dir to 775 or 777 depandant on your security concerns.

Regards,

Posted: Thu Jun 19, 2003 12:59 pm
by twigletmac
Have you tried using move_uploaded_file() instead of is_uploaded_file() and copy()?

Mac

Posted: Thu Jun 19, 2003 1:01 pm
by mikesheridan5
Thanks so much it must be a thursday if i didnt see that =)

Posted: Thu Jun 19, 2003 1:02 pm
by mikesheridan5
no twiglet mac ive never used that before i've always used is_uploaded_file and it's always worked so i just keep on using it =) if it aint broke dont fix it

Posted: Thu Jun 19, 2003 3:26 pm
by twigletmac
But it's always good to try things that have been created specifically for the task you are trying to achieve. Check out:
http://php.net/manual/en/features.file-upload.php

Mac

Posted: Thu Jun 19, 2003 4:03 pm
by mikesheridan5
Thanks alot twigletmac ill do some messing around and see what works better =)

Cheers