What are the limitations of using the input type file in PHP to retrieve file paths from a local machine?

When using the input type file in PHP to retrieve file paths from a local machine, there are limitations in terms of security and file access. To solve this issue, it is recommended to use server-side file handling to securely upload files to the server and then process them accordingly.

<?php
if(isset($_FILES['file'])){
    $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.";
    }
}
?>