How can the use of $_FILES['File'] improve the functionality of a file upload script in PHP?

Using $_FILES['File'] allows us to access the file that was uploaded through a form in PHP. This superglobal variable contains information about the uploaded file such as its name, type, size, and temporary location. By utilizing $_FILES['File'], we can easily handle file uploads in our PHP script, validate the file, move it to a desired location, and perform any other necessary operations.

<?php
if(isset($_FILES['File'])) {
    $file_name = $_FILES['File']['name'];
    $file_size = $_FILES['File']['size'];
    $file_tmp = $_FILES['File']['tmp_name'];
    
    move_uploaded_file($file_tmp, "uploads/" . $file_name);
    
    echo "File uploaded successfully!";
} else {
    echo "Please select a file to upload.";
}
?>