Firebase Polymer从存储中删除文件

时间:2017-02-18 19:55:33

标签: javascript firebase firebase-realtime-database polymer firebase-storage

我想从firebase存储中删除一些文件

service firebase.storage {
    match /b/summit.appspot.com/o {
    match /{allPaths=**} {
    allow read, write: if request.auth != null;
  }
 }
}

这些是我的存储规则。 我想通过使用演示函数来测试该功能

  _demoremove: function() {

    var storageRef = firebase.storage().ref(); 
    // Create a reference to the file to delete
    var desertRef =   storageRef.child('https://firebasestorage.google'); //i js copied a download-url from my one of the files in the storage

    // Delete the file
    desertRef.delete().then(function() {
      // File deleted successfully
      console.log('done');
    }).catch(function(error) {
      // Uh-oh, an error occurred!
      console.log(error);
    });

  }

这种格式有什么问题吗?我收到错误object is not found

1 个答案:

答案 0 :(得分:1)

为什么要在您的desertRef中放置一个URL?不应该有你的下载链接。但是,它应该存储存储文件的路径。例如:

var storageRef = firebase.storage();
var desertRef = storageRef.child("/images/image.jpg");