Reema
Reema

Reputation: 21

how to differentiate between images in storage in Firebase android?

I need to upload multiple images related to multiple things for example images for users images for categories and etc ...

when I searched about uploading images in Firebase they are upload them in Storage but if I want for example to retrieve all users images how can I do that ?

Upvotes: 0

Views: 208

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599956

You'll typically want to store the images from each user in a separate folder, so that you can secure access to it. So:

/uid1/image1
/uid1/image2
/uid2/image3
/uid2/image4

But even with that structure you can't get a list of the files from the Firebase SDK for Cloud Storage. See these questions for more on that:

So you'll typically want to store the path and/or download URL for each image in a separate location too. The Firebase Realtime Database and Cloud Firestore are great for that. If you store them in a similar structur as the files in Storage, it'll be easy to query for just the images of a specific user.

Upvotes: 0

Related Questions