What role does the $_FILES variable play in handling file uploads in PHP?

The $_FILES variable in PHP is used to handle file uploads. It contains information about the uploaded file such as the file name, file type, file size, and temporary location on the server. This variable is essential for processing file uploads in PHP.

<?php
if(isset($_FILES['file'])){
    $file_name = $_FILES['file']['name'];
    $file_tmp = $_FILES['file']['tmp_name'];
    
    // Move uploaded file to desired directory
    move_uploaded_file($file_tmp, "uploads/" . $file_name);
}
?>