What is the significance of using move_uploaded_file instead of copy when saving uploaded files to a different directory in PHP?

When saving uploaded files to a different directory in PHP, it is important to use `move_uploaded_file` instead of `copy` for security reasons. `move_uploaded_file` not only moves the uploaded file to the specified directory but also performs additional security checks to ensure that the file was uploaded via HTTP POST. This helps prevent malicious files from being executed on the server.

$uploadedFile = $_FILES['file']['tmp_name'];
$destination = 'uploads/' . $_FILES['file']['name'];

if (move_uploaded_file($uploadedFile, $destination)) {
    echo "File uploaded successfully.";
} else {
    echo "Failed to upload file.";
}