I have a web application that allow users to upload images. When they do an upload, an entry is created in the relational database with an uuid. The image is then saved in a file system with the uuid.
For example user uploads an image called car.jpg, then it is saved in the database as:
- original_file_name:
car.jpg - uuid:
4f1910d9-49d0-43c8-a84b-49c57eb8b8e1.
In the filesystem the image is saved as 4f1910d9-49d0-43c8-a84b-49c57eb8b8e1.jpg.
Right now I'm serving these images as http://localhost:3000/4f1910d9-49d0-43c8-a84b-49c57eb8b8e1.jpg".
This is a really bad practice as I am exposing the uuid to the user. What are some good solutions to serve images in the file system without exposing the uuid or is this the wrong way to even store images?
I would really appreciate your input. Thanks!
Aucun commentaire:
Enregistrer un commentaire