Recently, while I was building an application on Firebase and implementing Firebase Storage, I realised that I have to always consult old Firebase projects I have built or scour the web for blogs and documentation that explain not only how to do uploads to Firebase Storage but also write rules to protect them.

My use-case is as follows:

  • Users can create listings
  • A listing can have one or more images
  • An image is uploaded to Firebase Storage in the form of listing-images/userId/filename.extension
  • I only want to allow users to write to this folder if they are that user currently logged in. This folder becomes a bucket for all of the users listing images.

#firebase #uploadable #storage

Protected User Uploadable Files With Firebase Storage
1.25 GEEK