PDA

View Full Version : Copy file between folders



gloradin
03-18-2008, 06:17 PM
Hello,
I try to copy a file to another folder but I don't know how I made this. I try with function 'copy' but don't work, or I do something wrong!
I have two folders in my server, the folder "pastaum" have inside the file "cha.gif", and I want to copy the file "cha.gif" to "pastadois".
The file made the script work, calls index.php, and the url is "http://experimental.gloradin.com/index.php", and inside I put this code:
---------------------------------------------------------
<?
$origem = '/public_html/experimental/pastaum/cha.gif';
$destino = '/public_html/experimental/pastadois/cha.gif';
copy ($origem, $destino);
?>
-----------------------------------------------------------
If you go to http://experimental.gloradin.com/index.php you see this warning: Warning: copy(/public_html/experimental/pastaum/cha.gif) [function.copy]: failed to open stream: No such file or directory in /home/gloradin/public_html/experimental/index.php on line 4.

Please somebody help me for I copy the file "cha.gif" from "pastaum" to "pastadois".

The best regards,
gloradin

felgall
03-18-2008, 06:58 PM
Try removing the /public_html/experimental/ references as you don't have a folder within the domain called public_html

gloradin
03-21-2008, 04:59 AM
Thanks felgall, I put like you say and that works.
When we do some scripts sometimes we don't see the simplicity of things.

The best regards,
gloradin