What are the best practices for providing feedback to users during file uploads in PHP forms?

When users upload files in PHP forms, it is important to provide feedback to them to ensure a smooth user experience. One best practice is to display a progress bar or message indicating the status of the upload. This helps users understand the progress and prevents any confusion or frustration.

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