Move File Path?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm trying to move some files on my server but I cannot get the path
right.  I've messed with this and can't get it right.  Is there a way
to debug the path of a file on the server?  Here is what I'm trying to
do.  I have a upload.php file in root/beta/upload/upload.php and want
to move a file in the root to root/beta/files but I get error below.
What am I missing?

$file = 'After.jpg';
$newfile = '/beta/files/TestMe.jpg';

if (!copy($file, $newfile)) {
   print "failed to copy $file...\n";

Warning: copy(After.jpg): failed to open stream: No such file or
directory in
on line 5
failed to copy After.jpg...

Re: Move File Path?

Well I think I figured it out, it must be all relative to the upload
file.  I thought the path was relative to the root.  This seems to have
fixed it for me

$file = '../../After.jpg';
$newfile = '../../beta/files/TestMe.jpg';

Re: Move File Path?

Barkster wrote:
Quoted text here. Click to load it


   $file = '/After.jpg';

Yours is a relative path; precede it with a / to get the absolute path to root.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline