What are the potential pitfalls of using $HTTP_POST_FILES instead of $_FILES in PHP?

Using $HTTP_POST_FILES instead of $_FILES in PHP can lead to compatibility issues with newer versions of PHP, as $HTTP_POST_FILES was deprecated in PHP 5.0.0 and removed in PHP 5.3.0. To avoid potential pitfalls, it is recommended to use $_FILES instead for handling file uploads in PHP.

// Correct way to handle file uploads using $_FILES
if ($_FILES['file']['error'] === UPLOAD_ERR_OK) {
    $uploadPath = 'uploads/' . basename($_FILES['file']['name']);
    move_uploaded_file($_FILES['file']['tmp_name'], $uploadPath);
    echo 'File uploaded successfully!';
} else {
    echo 'Error uploading file.';
}