How can the $_FILES array be utilized to assign specific names to individual uploaded files in PHP?

When uploading multiple files using PHP, the $_FILES array contains information about each file, including its temporary location and original name. To assign specific names to individual uploaded files, you can loop through the $_FILES array and move each file to a new location with the desired name.

foreach ($_FILES['upload']['tmp_name'] as $key => $tmp_name) {
    $new_name = 'file_' . $key . '.' . pathinfo($_FILES['upload']['name'][$key], PATHINFO_EXTENSION);
    $new_location = 'uploads/' . $new_name;
    move_uploaded_file($tmp_name, $new_location);
}