What functions in PHP can be used to handle file uploads securely and efficiently?

To handle file uploads securely and efficiently in PHP, the functions `move_uploaded_file()` and `is_uploaded_file()` can be used. These functions help ensure that uploaded files are moved to a secure location on the server and that only files uploaded through the HTTP POST method are processed.

<?php
$uploadDirectory = 'uploads/';

if(isset($_FILES['file']) && is_uploaded_file($_FILES['file']['tmp_name'])){
    $fileName = $_FILES['file']['name'];
    $destination = $uploadDirectory . $fileName;

    if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)){
        echo 'File uploaded successfully.';
    } else {
        echo 'Error uploading file.';
    }
} else {
    echo 'Invalid file upload.';
}
?>