Back

Storing DocID on uploaded files,picutres etc ?

  • 1
  • Web
  • Databases
  • Accounts
  • Storage
  • Users
Ayush_Parui
19 Oct, 2023, 05:22

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 ?

TL;DR
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
19 Oct, 2023, 06:30

Please reply?

LDs_Group
19 Oct, 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

Drake
20 Oct, 2023, 01:39

I'm the document, you would put the file id...

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more