-2
I’d like to take the value of url_imagem
and use as function Return upImage
. I tried several things and could not find solution.
function upImage(nomeDaPlanta, imgFile){
var file = imgFile.files[0];
console.log(file);
storageRef.child(nomeDaPlanta + ".jpg").put(file).then(function(snapshot) {
console.log(snapshot);
var url = snapshot.ref.getDownloadURL().then(function(url_imagem) {
console.log(url_imagem);
}).catch(error => {
console.log(error);
});
});
return url_imagem;
}
I suggest you read: How can I use javascript async/await? and What are Javascript prefixes (promises)?
– Cmte Cardeal