What resources or tutorials are recommended for learning PHP file upload functionality?

When learning about PHP file upload functionality, it is recommended to refer to the official PHP documentation on file uploads (https://www.php.net/manual/en/features.file-upload.php) as it provides detailed information on how to handle file uploads in PHP. Additionally, tutorials on websites like W3Schools (https://www.w3schools.com/php/php_file_upload.asp) and tutorialspoint (https://www.tutorialspoint.com/php/php_file_uploading.htm) can be helpful for beginners to understand the process of uploading files using PHP.

<?php
if($_FILES['file']['error'] == 0){
    $target_dir = "uploads/";
    $target_file = $target_dir . basename($_FILES["file"]["name"]);
    if(move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)){
        echo "The file ". basename( $_FILES["file"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
} else {
    echo "Error: " . $_FILES["file"]["error"];
}
?>