Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy function

Status
Not open for further replies.

dingleberry

Programmer
Joined
Dec 13, 2002
Messages
143
Location
US
Hi, I've got a problem with a copy function I'm hoping someone out there has seen before.

I'm running an uploading script (or attempting to)

$upfile = "/home/theorangestudio/uploads/".$userfile_name;

if ( !copy($userfile, $upfile))

{
echo "Problem: Could not move file into directory $upfile";
exit;
}

and needless to say, I keep getting the problem could not move.... error.

I've declared my upload_tmp_dir = "/home/uploads/" in php.ini and enabled http uploads as well as set max size to 2M. I then set the /home/uploads permissions to 777 and also the $upfile directory permissions to 777. Still, not getting the copy function to work. I believe the file is uploading to temp directory, but copy is where the problem is. Do I have to give ownership of either /home/uploads or $upfile to nobody or something? Currently they're owned by my account (not root -- but I do have root access if I need it).

This is a shared hosting environment. Any ideas?

Thanks,
dan
 
Hi dingleberry,

(I feel silly calling you that, please don't think I'm calling you names.)

Random question: /home is at the very top of the server's directory structure? That is to say, it's really /home and not /usr/local/dingleberry/
inger
 
Hey inger,

Thanks for your response.
that is correct. home is right below root. whole path is

/home/uploads/

why do you ask?
 
Got it.

I was using

copy($userfile, $upfile);
for a command when I should have been using

copy($userfile_tmpname, $upfile);

can't believe it took me 15 hours to figure that out.

Thanks for you help.
dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top