Rename() function for moving files : File Copy Move « File Directory « PHP






Rename() function for moving files


<?php
   $source = "./test.txt";
   $destination = "./copy.txt";
                 
   if (rename($source, $destination)) {
      echo "The file was moved successfully.", "\n";
   } else {
      echo "The specified file could not be moved. Please try again.", "\n";
   }
?>


           
       








Related examples in the same category

1.Use of the copy() function