Use of the copy() function : File Copy Move « File Directory « PHP






Use of the copy() function

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


           
       








Related examples in the same category

1.Rename() function for moving files