小编I N*_*aya的帖子

如何在 React Native fetch blob 中将多个图像上传到 firebase

我有多个存储在数组中的图像(存储在数组中的图像路径)。然后我使用 for 循环上传每张图片,但只上传最后一张图片。我使用 react native fetch blob 和 firebase

for(var i = 0; i < this.state.imagesUri;i++){
 Blob.build(RNFetchBlob.wrap(this.state.imagesUri[i].path),{ type : 'image/jpeg' })
            .then((blob) => firebase.storage()
            .ref("userPhoto").child("image"+i)
            .put(blob, { contentType : 'image/png' }).then(()=>{
   var storage =  firebase.storage().ref("userPhoto/").child("image"+i);
              storage.getDownloadURL().then((url)=>{
                var url = url;
              });
            })
          );
        }
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-android firebase-storage

-1
推荐指数
1
解决办法
1855
查看次数