I'm currently working on a social platform where users create posts similar to Facebook or Linkedin. So what I'm trying to achieve is, whenever user create a post they may upload images as part of the post and I want to store them in firebase storage but what I'm not clear is, what type of storage path I should choose from one of the below for uploading images. Can someone please suggest which option is right for user posts from the below
- Create unique storage path for every post of a user and upload respective post images there
- Create unique storage path for every user and upload all user posts images there
- Create a generic storage path for all users and upload all users posts images there
I'm using firebase storage and database for this app.
CodePudding user response:
There is no singular correct or best approach here, it all depends on your app's needs and use-cases.
I typically would use a folder structure with /images/$uid/$postid, for example because it makes it easy for me to delete all images for a specific user, as well as all images for a specific post. But as you can see from that description, that calls out two specific use-cases that might or might not be relevant for your app.
