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

The $_FILES variable in PHP is used to handle file uploads from HTML forms. It stores information about the uploaded file such as file name, file type, temporary location, and file size. To process file uploads in PHP, you need to use the $_FILES variable to access and move the uploaded file to a desired location on the server.

<?php
if(isset($_FILES['file'])){
    $file_name = $_FILES['file']['name'];
    $file_tmp = $_FILES['file']['tmp_name'];
    $file_destination = "uploads/" . $file_name;

    move_uploaded_file($file_tmp, $file_destination);
    echo "File uploaded successfully!";
}
?>