I have a web app where a user can create multiple documents in the database and also upload images, the problem is how will I identify for particular which document the image was uploaded
eg. If I create a blog where user can add image, name, etc, what if the user creates multiple blogs and add image to those blogs, for every blog a separate document is needed to be created how can I add the document Id to identify this particular image belong to this blog ?
Summary
The user wants to know how to identify which image belongs to which document in a web app where users can create multiple documents and upload images. The solution suggested is to store a unique ID for each document, such as an ID generated using the ID.unique() or UUID functions, and use that ID as the image URL in the database and as the fileId in the file storage bucket. This way, the user can easily identify which image belongs to which document by matching the document's ID with the image's URL or fileId.
Ayush_Parui
Rank 1: Thread
Oct 19, 2023, 06:30
Please reply?
LDs_Group
Rank 2: Process
Oct 19, 2023, 06:33
You can store a unique ID with ID.unique() or UUID in a variable. So use the same id as image_url in your database and as your fileId in the bucket