DEV Community

Discussion on: Don't use timestamps with multi-image uploads.

Collapse
 
hbgl profile image
hbgl

Excellent post. Another technique for generating unique file names would be to rely on the database as the source of truth. Usually when you upload a file you also save a record in the database for that file. You can include the primary key value of the record in the file name to make it unique.
I have also seen UUIDs being used as file names which is more akin to your solution.

Collapse
 
jringeisen profile image
Jonathon Ringeisen

These are also excellent solutions.