javascriptfirebasefirebase-storagefirebase-console

How to create a folder in Firebase Storage?


So the new Firebase has support for storage using Google Cloud Platform.

You can upload a file to the images folder using:

var uploadTask = storageRef.child('images').put(file, metadata);

What if you want to create a subfolder images/user1234 dynamically using code?

The offical sample does not show how to do that, nor the official guide or reference docs.

Is the Firebase Console the only place where folders can be created manually?


Solution

  • The Firebase Console does allow you to create a folder, since it's the easiest way to add files to a specific folder there.

    But there is no public API to create a folder. Instead folders are auto-created as you add files to them.

    Firebase Storage is based on Google Cloud Storage. See the documentation provided by GCS about the illusion of folders.