Page 1 of 1

upload script giving copy error

Posted: Wed Sep 10, 2003 4:12 pm
by Trip1
http://www.nomorepasting.com/paste.php?pasteID=9172
-----------------------------------------------------------------
Hello, Im writing an upload script for 6 pictures, and im getting this error when i try to copy something:

Warning</b>: copy(home/ecliptic/public_html/myface/mkelly09/img_tuto9-01a.jpg): failed to open stream: No such file or directory in <b>/home/ecliptic/public_html/myface/addpicture.php</b> on line <b>147</b><br />

I have no idea why its giving me this error, /home/ecliptic/public_html/mkelly09 exists and is chmodded 777.

Since theres alot of code in that link i gave you, focus in more on lines 145-220 since thats where i use the copy commands.

You will notice that for pic_6 I tried to change it so that it copies to /home/ecliptic/public_html/mkelly09 instead of the others which copy it to /home/ecliptic/public_html/mkelly09/file_name_here

It doesn't work in each case..

any help is appreciated, thanks in advance!

Posted: Wed Sep 10, 2003 7:48 pm
by rprins
Just a quick question.

The directory is 0777, but are the files in the directory 0777? I have had this problem in the past and it would be something to look into.

RE

Posted: Wed Sep 10, 2003 8:38 pm
by Trip1
Yes the files and directory is chmodded 777, I have checked all the permissions twice now and they all are 777.

Posted: Thu Sep 11, 2003 4:41 am
by pootergeist
add / before home - leaving it off will (unless you force base directory) use a relative path.

btw - you should think about iterating a loop for multiple uploads rather than writing the code for every single one

<input type="file" name="upload_file[]" />
<input type="file" name="upload_file[]" />

foreach($_FILES['upload_file']['error'] AS $indx=>$value)
{
if($value == 0)
{
echo $_FILES['upload_file']['tmp_name'][$indx];
}
}

Posted: Thu Sep 11, 2003 4:44 am
by pootergeist
I also presume you have the first parameter in the copy statement

copy(from here, to here);