php move_uploaded_file to another directory code example
Example 1: php move_uploaded_file
$upload_folder = "upload/";
$file_location = $upload_folder . basename($_FILES["fileToUpload"]["name"]);
if(isset($_FILES['fileToUpload'])){
if(move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $file_location)){
echo 'Files has uploaded';
};
}
Example 2: PHP Move File from One Folder to Another
<?php $filePath = 'images/test.jpeg'; $destinationFilePath = 'copyImages/test.jpeg'; if( !rename($filePath, $destinationFilePath) ) { echo "File can't be moved!"; } else { echo "File has been moved!"; } ?>