Mega Code Archive

 
Categories / Php / File Directory
 

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>";      } ?>