Use your technique, but double check if the file exists first, and if it does, then generate another unique file name until it is finally unique.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only