$target_dir = "uploads/"; // specify the target directory $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); // get the file name with the target directory if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { // move the uploaded file to the target directory echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; }In the above code, we have specified the target directory, created a target file path by concatenating the target directory and the uploaded file name, and then used the `move_uploaded_file()` function to move the uploaded file to the target directory. Package Library: This function is a part of the PHP core library and does not require a package or library to be installed separately.