Hi,
I have a test to see if a file name exist before it is uploaded. If the name exist, the string "_000" will be appended to the file name (ie: bob.jpg exists, incoming bob.jpg is renamed to bob_000.jpg).
My problem lies with what happens when the newly renamed file already exists too! (ie: incoming bob.jpg is renamed to bob_000.jpg, BUT bob_000.jpg already exist on the server!).
I'm looking for a way to automatically test if the new name already exist, and if it does, the new suffix will be existing suffix plus one (ie: if bob_000.jpg exist TOO, the new file name will be bob_001.jpg). A "1" will be added to the suffix until a file name that does not exist is found (if bob_001.jpg ALSO exists, it will be renamed to bob_002.jpg...continue until a new file name is found.
THANKS!
PAHC