PHP/File Directory/File Copy Move
Rename() function for moving files
<source lang="html4strict">
<?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"; }
?>
</source>
Use of the copy() function
<source lang="html4strict">
<?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"; }
?>
</source>