Checks if the file exists inside the folder. If not it will create a unique name for the file.
filename_exists( sting $directory [, string $file, array $options ] ) : string
$directory (string) (Required) The directory to check for the image.
$file (string) (Optional) The file in the directory you want to check.
$options (string) (Optional) dateformat - d,m,y, php date format constant, hash - false to remove hash string
(string) New unique filepath.
$file = filename_exists(IMAGES, 'test.png');
// do someting with file... (upload, copy etc.)