0

I am currently building a web app that uploads files in a folder in Firebase. Each time I upload a file in Firebase storage folder I also use Firebase database to store the file name and download URL. Is it possible to retrieve all files that are stored in the specific folder as an array so the user can choose which one he wants to download?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
user3397260
  • 241
  • 5
  • 17

1 Answers1

2

Since you are linking the url of the image in the database for example:

Uploads
  pushid
     urlfile: url_here
     uploadedby: userx
  pushid
     urlfile: url_here
     uploadedby: usery

you can change the database as you want

You can then do this:

firebase.database().ref("Uploads").orderByChild('urlfile').on('value', function(snapshot) {
snapshot.forEach(function(child) {
var files=child.val().urlfile;
 )};
)};

this way you can retrieve the urls from the database and then store them in an array using push()

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134