0

Is there any way to fetch all the URLs from Firebase Storage?

enter image description here

I know there are ways to fetch URLs from firebase database like storing URLs of Firebase Storage files in Firebase Realtime Database and fetch from it. But I am uploading images from the button which is showing in the image and want URLs of all those uploaded images directly from the firebase storage path like...

var mStorageRef: StorageReference

mStorageRef = FirebaseStorage.getInstance().reference

and using it something like...

mStorageRef.fetchall() or mStorageRef.getall()

I also foudn this link where you can downlaod files by its name and only one by one. I want a way to fetch all at once.

Any help would be appreciated.

Kishan Solanki
  • 13,761
  • 4
  • 85
  • 82
  • Check **[this](https://stackoverflow.com/questions/53299915/how-to-get-offline-uploaded-file-download-url-in-firebase/53300660#53300660)** out. – Alex Mamo Jun 07 '19 at 11:29
  • 1
    You need to add the URL's of those images in your database and then fetch those database values – Vedprakash Wagh Jun 07 '19 at 11:31
  • @Alex Mamo I am uploading using button and not by code – Kishan Solanki Jun 07 '19 at 11:37
  • Version 6.1 of the Firebase JavaScript SDK added the ability to list files: https://firebase.google.com/support/release-notes/js#storage. For other platforms you'll have to do what Alex and Doug said, and what I also included in my linked answer. – Frank van Puffelen Jun 07 '19 at 14:26

1 Answers1

1

There is no provided API that lets you do this.

What you can do instead is use a Cloud Function that triggers on the creation of a new object in Cloud Storage, then have it create a signed URL. Store that URL in a database somewhere, then query the database when you need those URLs.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441