UUID Use Case
UUID Filename
User-supplied filenames collide and can contain paths or sensitive words. A UUID filename is unique and inert.
UniquePath-safeOpaque
Generated locally with the Web Crypto API — nothing leaves your browser.
What Is UUID Filename?
- Two users uploading
resume.pdfwould overwrite each other without unique names. A v4 UUID guarantees no collision. - It also avoids path-traversal and Unicode issues, since the name is plain ASCII hex.
How to generate
- Generate a v4 UUID as the stored filename.
- Keep the original name in metadata for display.
- Add an extension based on content type.
Use Cases
- User uploads (avatars, documents).
- Exports and reports.
- Temp working files.
Code Examples
JavaScript
const name = crypto.randomUUID() + path.extname(original);
await fs.writeFile(`/uploads/${name}`, buf);Frequently Asked Questions
Keep the original filename?
Store it separately for display, but use the UUID on disk to avoid collisions and traversal.
Add an extension?
Yes — derive it from the detected MIME type, not from the user-supplied name.
Related tools
UUID v1 GeneratorUUID v3 GeneratorUUID v4 GeneratorUUID v5 GeneratorUUID v6 GeneratorUUID v7 GeneratorUUID v8 GeneratorBulk UUID GeneratorShort UUID GeneratorUUID ValidatorUUID FormatterUUID as a Primary KeyUUID Database IDUUID Foreign KeyUUID Shard KeyUUID Partition KeyUUID in a Composite KeyUUID Surrogate KeyUUID API KeyUUID Session TokenUUID Access TokenUUID Refresh TokenUUID Idempotency KeyUUID Request IDUUID Correlation IDUUID Trace IDUUID CSRF TokenUUID NonceUUID FilenameUUID Object KeyUUID S3 KeyUUID Upload IDUUID Cache KeyUUID Blob NameUUID Temp FileUUID User IDUUID Account IDUUID Customer IDUUID Device IDUUID Tenant IDUUID Client IDUUID Anonymous IDUUID Member IDUUID Message IDUUID Event IDUUID Job IDUUID Task IDUUID Queue Message IDUUID Transaction IDUUID Order IDUUID Invoice IDUUID Payment IDUUID Reset TokenUUID Verification TokenUUID Invite CodeUUID API SecretUUID Share LinkUUID Magic LinkUUID Node IDUUID Worker IDUUID Lock IDUUID Cluster IDUUID Test DataUUID Seed DataUUID FixtureUUID Mock IDUUID Placeholder IDUUID Sample ID