In this tutorial, We will learn how to move a file from one folder to another. I would like to share with you move an image from one folder to another in PHP.
Example:
<?php
/* Store the path of source file */
$filePath = 'images/test.jpeg';
/* Store the path of destination file */
$destinationFilePath = 'copyImages/test.jpeg';
/* Move File from images to copyImages folder */
if( !rename($filePath, $destinationFilePath) ) {
echo "File can't be moved!";
}
else {
echo "File has been moved!";
}
?>
Thanks, I hope it will help you...