Javascript putFile不是一个函数

Javascript putFile不是一个函数,javascript,firebase,react-native,firebase-storage,Javascript,Firebase,React Native,Firebase Storage,我是一个新的本地人,正在尝试为慈善机构创建一个应用程序 我在尝试将相机拍摄的图像存储在Firebase存储中时遇到问题 下面是代码片段,查看控制台日志,所有内容都与我预期的一样,如下所示 我得到的错误是“imageRef.Putfile不是函数” 任何帮助都将不胜感激 控制台日志输出 ref, image, imageName breadalert-86646.appspot.com file:///data/user/0/host.exp.exponent/cache/ExperienceDa

我是一个新的本地人,正在尝试为慈善机构创建一个应用程序

我在尝试将相机拍摄的图像存储在Firebase存储中时遇到问题

下面是代码片段,查看控制台日志,所有内容都与我预期的一样,如下所示

我得到的错误是“imageRef.Putfile不是函数”

任何帮助都将不胜感激

控制台日志输出

ref, image, imageName breadalert-86646.appspot.com file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Frn-complete-guide-10d15822-a070-46a4-a2a0-98550f263c74/ImagePicker/8211188f-6bf4-4aaf-a3ba-e187b1e3707f.jpg CKhLXQlDUtUvKotCYQmJLmOeI1s247
getting storage ref of breadalert-86646.appspot.com
firebaseStorageRef is gs://breadalert-86646.appspot.com/
Image is gs://breadalert-86646.appspot.com/CKhLXQlDUtUvKotCYQmJLmOeI1s247
Image Path is file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Frn-complete-guide-10d15822-a070-46a4-a2a0-98550f263c74/ImagePicker/8211188f-6bf4-4aaf-a3ba-e187b1e3707f.jpg
代码片段

 saveImage = (ref, image, imageName, onSuccess, onError) => {


  console.log ('ref, image, imageName ' + ref + ' ' + image + ' ' + imageName);
  console.log ('getting storage ref of ' + ref);

  firebaseStorageRef = firebase.storage().ref();

  console.log ('firebaseStorageRef is ' + firebaseStorageRef);

  imageRef = firebaseStorageRef.child(imageName);
  console.log ('Image is ' + imageRef);
  console.log ('Image Path is ' + image);



  imageRef.putFile (image.path, {contentType: 'image/jpeg'}).then(function(){
      return imageRef.getDownloadURL();
  }).then(function(url){
    console.log ("Image url", {url:url});
      onSuccess(url);
  }).catch(function(error){
    console.log ("Error while saving the image.. ", error);
      onError(error);
  });
}

您的
imageRef
是一个类型对象。请查看链接的API文档-它没有名为
putFile()
的方法。这就是错误消息告诉您的


如果要上载文件,应使用名为的方法,如中所述。

是否尝试将
putFile
更改为just
put