Forums

PHP

This topic is locked

copy remote file from one folder to another

Posted 14 Apr 2007 00:15:32
1
has voted
14 Apr 2007 00:15:32 Marty mthomas9 posted:
I'm trying to copy a file from one remote folder to another. The php "rename" function (below) works perfect, however it deletes the original file.

<?php
rename('../designs/Design2/', $row_rs_user['username']);
?>

When I try to use the "mkdir" and "copy" function (below) to first create the folder and then to copy to that folder i get the following error: [function.copy]: failed to open stream.

<?php mkdir(../clients/$row_rs_user['username']); ?>
<?php copy('../designs/Design2/', $row_rs_user['username']); ?>

Any ideas would be appreciated.

Replies

Replied 15 Apr 2007 21:56:21
15 Apr 2007 21:56:21 Kenneth Halley replied:
copy is supposed to be for copying files- you haven't specified a file- just a directory.

Also I tend to use absolute server paths when doing file tasks ie: the full unix ( or whatever) path
"/home/domains/mydomain.com/public_html/directory1"
I know you can use url paths but it depends if you have done all the config for it to accept this- wrappers etc.

-----------------------------------
www.halleynet.co.uk

Reply to this topic