A file can be renamed with the rename() function : rename « File Directory « PHP






A file can be renamed with the rename() function

 
Its syntax is: bool rename (string oldname, string newname)

<?
    $data_file = "data.txt";
    rename($data_file, $data_file.'.old') or die("Could not rename $data_file");
?>
  
  








Related examples in the same category

1.Moving Files with rename( )
2.Moving a file