Copying files : copy « File Directory « PHP






Copying files

 
<?php 
  $source = "C:\\Apache\\logs\\error.log";
  $dest = "C:\\error.bak";

  if( copy( $source, $dest ) )
  {
    $msg = "Copied $source<br>to $dest";
  }
  else
  {
    $msg = "Unable to copy $source";
  }
?>

<html>

 <head>
  <title>Copying files</title>
 <head>

 <body>

  <?php echo($msg); ?>

 </body>

</html>
  
  








Related examples in the same category

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