How can the use of move_uploaded_file() function in PHP be affected by missing MIME type or tmp_name values in the $_FILES array?

If the MIME type or tmp_name values are missing in the $_FILES array, the move_uploaded_file() function in PHP will not be able to properly handle the file upload process. To solve this issue, you should always check if these values are set before attempting to move the uploaded file.

if(isset($_FILES['file']['tmp_name']) && isset($_FILES['file']['type'])){
    $tmp_name = $_FILES['file']['tmp_name'];
    $file_name = $_FILES['file']['name'];
    $destination = 'uploads/' . $file_name;
    
    if(move_uploaded_file($tmp_name, $destination)){
        echo "File uploaded successfully.";
    } else {
        echo "Error uploading file.";
    }
} else {
    echo "Missing tmp_name or MIME type in the uploaded file.";
}