To upload the image to the firestore when I click the upload button by using javascript

Viewed 94

I am creating a web site that has the image upload to it, I want to upload the image only when I click the upload button. here is the code that im using right now.

fileBtn.addEventListener('change', function(e){
for(let i =0; i<e.target.files.length; i++){
let imageFile = e.target.files[i];
let storageRef = firebase.storage().ref("Images" + imageFile.name);
let storageRef = firebase.storage().ref("Images/ProPic" + imageFile.name);
let task = storageRef.put(imageFile);      
}
})
0 Answers
Related