Using the copy() Function : copy « File Directory « PHP






Using the copy() Function

 
<?php
     function move($source, $dest) {
          if(!copy($source, $dest)) return false;
          if(!unlink($source)) return false;
          return true;
     }

     if(!move("data.txt", "/tmp/tmpdir/newfile.txt")) {
                    echo "Error! Couldn't move the file!<BR>";
     }
?>
  
  








Related examples in the same category

1.Copying Files with copy( )
2.Copying a file
3.Copying files
4.Make a copy of a file: copy() function.