What is the recommended method in PHP to move uploaded files to a different directory on the same server?

When a file is uploaded to a PHP server, it is typically stored in a temporary directory. To move the uploaded file to a different directory on the same server, you can use the `move_uploaded_file()` function provided by PHP. This function takes two parameters: the temporary file path of the uploaded file and the destination path where you want to move the file.

$uploadedFile = $_FILES['file']['tmp_name'];
$destination = '/path/to/destination/directory/' . $_FILES['file']['name'];

if (move_uploaded_file($uploadedFile, $destination)) {
    echo 'File moved successfully.';
} else {
    echo 'File move failed.';
}