Hi guys,
I've created this little function to check whether a user has uploaded a
file with the same name as an existing file, and if so rename it to
file-1.jpg, file-2.jpg etc.
clearstatcache();
if(file_exists("$BasePath/$FileName.jpg")){
$extra=1;
while(file_exists("$BasePath/$FileName-$extra.jpg")){
$extra++;
}
$FileName="$FileName-$extra";
}
However if files are deleted outside PHP file_exists still returns true so
it keeps adding higher numbers to the files.
Is there any way I can get round this? The strange thing is if I call
file_exists() on a folder it works fine.
--
Regards,
Andrew Crowe