How to add image link to firebase?

I am trying to add an image to firebase and while the image is uploading to my storage it is not uploading to my database. How can I fix this. This is the code I have for that section

for (let i = 0; i < filess.length; i++) {
            storage.ref(refUUID + '/' + filess[i].name).put(filess[i]).then(() => {
                storage.ref(refUUID + '/' + filess[i].name).getDownloadURL().then(function (url) {
                    database.ref(listingType + '/' + refUUID + '/Description/Images/Image' + (i + 1)).set({
                        Link: url,
                        name: 'Image' + (i + 1)
                    })
                });
            });
        }