Uploading a local stored image to Firebase Storage

谁说胖子不能爱 提交于 2020-06-15 07:09:53

问题


I am trying to do what should be a pretty simple operation.

I have the following image in the same directory as my app.js

  Project
    |______ app.js
    |
    |______ image.png

I would like to upload this image.png in my firebase storage. According to my understanding I would need to make it a blob.. or am I wrong? How could I tackle that?

This is my most recent attempt:

 var ref = firebase.storage().ref().child("userImages/" + firebase.auth().currentUser.uid);
 ref.put('./image.png'.blob());

Any ideas on how I can go about doing this? Is this only possible using external libraries?

I am also looking to see if there is a proper/better way to do this over some others.

来源:https://stackoverflow.com/questions/61884123/uploading-a-local-stored-image-to-firebase-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!