Forum Moderators: coopster

Message Too Old, No Replies

File Rename

get "No such file..."

         

henry0

4:15 pm on Dec 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello
Still in my templating saga!

I have another file that copy a template from a folder (here for the example: footer.php)
to another folder
within that folder where now is the new copied "footer.php"
I run the following script
Which results in "No such file et..."
The idea behind $ID is that the new file got to be have a different name than other similar files
And got to be unique so I grab the ID from the DB and pass it to be part of the renamed file
Well it does not work as planned!
Thanks for looking at the script

Henry

<?
$rename=$id;
$file_name = footer.php;
$read_extension = explode(".", $file_name);
$ext = $read_extension[1];
$renamed = $rename.".".$ext;
rename($file_name, $renamed);

?>

coopster

2:41 pm on Dec 26, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Is your $file_name variable assignment supposed to be a string? If so, you forgot your quotation marks:

$file_name = 'footer.php';

henry0

3:49 pm on Dec 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Coopster
yes I did forget that

Henry