Are there simpler alternatives to the provided upload script for renaming files in PHP?

The provided upload script for renaming files in PHP may be overly complex for simple file renaming tasks. A simpler alternative would be to use the `move_uploaded_file` function along with `uniqid()` to generate a unique filename. This approach eliminates the need for a separate function to handle file renaming.

<?php
$uploadDirectory = "uploads/";
$uploadedFile = $_FILES['file']['tmp_name'];
$extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$newFileName = uniqid() . '.' . $extension;

if(move_uploaded_file($uploadedFile, $uploadDirectory . $newFileName)) {
    echo "File uploaded successfully!";
} else {
    echo "Error uploading file.";
}
?>