How can PHP access and process uploaded files using the $_FILES superglobal?

To access and process uploaded files using the $_FILES superglobal in PHP, you can use the 'tmp_name' key to access the temporary location of the uploaded file on the server. You can then move the file to a permanent location using the move_uploaded_file() function. Additionally, you can access other information about the uploaded file such as its name, size, type, and error status from the $_FILES superglobal array.

<?php
if(isset($_FILES['file'])){
    $file_name = $_FILES['file']['name'];
    $file_size = $_FILES['file']['size'];
    $file_type = $_FILES['file']['type'];
    $file_tmp = $_FILES['file']['tmp_name'];
    
    $destination = "uploads/" . $file_name;
    
    if(move_uploaded_file($file_tmp, $destination)){
        echo "File uploaded successfully.";
    } else {
        echo "Error uploading file.";
    }
}
?>