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?
1 Answer
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()
2 Comments
Peter Haddad
@user3397260 did the answer help?
user3397260
It was very helpful man thank you but I treed a different approach, thanks for your response man