This functions checks of the file $file exists inside the folder $folder, if not it will create a unique name for the file to make sure it can be uploaded without replacing other files.
Quote
filename_exists ( string $dir , string $file )
<?php
/* Content in DOWNLOADS dir
file.zip
file_1.zip
file_2.zip */
require_once INCLUDES."infusions_include.php";
$dir = DOWLNOADS;
$file = "file.zip";
echo filename_exists($dir, $file);
?>