Forum Moderators: coopster
I am simply trying to change the name of an existing file using the rename() function but it just doesn't seem to work, does anyone have any suggestions that might help?
here is what I am using:
$flgRename = rename("pages/gps.php", "pages/new.php")
if($flgRename)
{
echo "success!";
}
else
{
echo "failed";
}
I just get 'failed' and no name change.
Cheers,
Andy
Just found this on php.net, "rename() fails with PHP4 and PHP5 under Windows if the destination file exists, regardless of file permission settings."
-http://us.php.net/manual/en/function.rename.php#60341
Tried out some other suggestions on there too but still getting nothing.
if (file_exists("pages/new.php")) {
unlink("pages/new.php");
}
rename("pages/gps.php", "pages/new.php");