Page 1 of 1

Problem moving files--PLEASE HELP!

Posted: Sat Mar 20, 2004 9:52 am
by andylyon87
Can anyone tell me why this doesn't work, it is meant to move a file from one folder to another; in this case it moves a file (listed on a directory) from a "form_data" folder to a "moderated" folder. I have created both folders and have inserted some test txt files, but it keeps saying the file or directory don't exist.

Code: Select all

if($Rename){
for($n = 0;$n < count($Rename); $n++)&#123;
$OldFilename = $Rename&#1111;$n];
$Old = "form_data/$OldFilename";
$New = "moderated/$OldFilename";
if(rename("$Old", "$New"))&#123;
print("<TR><TD colspan=4><CENTER>Your file $Rename&#1111;$n], was successfully moved!</TD></TR>");
&#125;else&#123;
print("<TR><TD colspan=4><CENTER>Your file, $Rename&#1111;$n], could not be moved.</TD></TR>");
&#125;
&#125;
print("<TR><TD colspan=4><center>&nbsp;</TD></TR>");
&#125;

Posted: Sat Mar 20, 2004 10:35 am
by Illusionist
have you tried using an absolute path?? ie: \path\to\form_data and \path\to\moderated ??

Posted: Sat Mar 20, 2004 1:03 pm
by andylyon87
this seems to be having no effect, could I use the copy function and then use the delete function to delete the original