How can the file_force_extension property of the verot.net/php_class_upload.php class be utilized to prevent duplicate file extensions in uploaded files?

To prevent duplicate file extensions in uploaded files, we can utilize the file_force_extension property of the verot.net/php_class_upload.php class. By setting this property to true, the class will automatically append a unique number to the file name if a file with the same name and extension already exists in the upload directory.

// Set the file_force_extension property to true to prevent duplicate file extensions
$upload = new upload($_FILES['file']);
$upload->file_force_extension = true;
$upload->process('/path/to/upload/directory');

if ($upload->processed) {
    echo 'File uploaded successfully';
    $upload->clean();
} else {
    echo 'Error: ' . $upload->error;
}