How can PHP beginners learn to properly handle file uploads and display them on a webpage?

Beginners can learn to handle file uploads in PHP by using the $_FILES superglobal to access the uploaded file data, move the file to a desired location on the server using move_uploaded_file(), and then display the uploaded file on a webpage using appropriate HTML tags and PHP code to generate the file path.

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

    if(move_uploaded_file($file_tmp, $file_destination)){
        echo "File uploaded successfully: <a href='$file_destination'>$file_name</a>";
    } else {
        echo "Error uploading file.";
    }
}
?>

<form method="post" enctype="multipart/form-data">
    <input type="file" name="file">
    <input type="submit" value="Upload">
</form>