Meteor-Files: Can't set allow/deny rules

Currently, I try to protect my application with allow/deny rules and server methods. Server methods didn’t worked. I tried to pass my base64 as an argument for Meteor.call but the server respond that he don’t know “Images.insert”

So I though allow/deny should work but i was wrong… In my lib folder, i create my database with

this.Images = new Meteor.Files({
  debug: true,
  collectionName: 'Images',
  allowClientCode: false, // Disallow remove files from Client
  storagePath: '/imagesUpload2/',
  onBeforeUpload: function (file) {
    // Allow upload files under 100MB, and only in png/jpg/jpeg formats
    if (file.size <= 1024*1024*100 && /png|jpg|jpeg/i.test(file.extension)) {
      return true;
    } else {
      return 'Please upload image, with size equal or less than 10MB';
    }
  }
});  

I tried just to block all insertions with

Images.deny({
    insert: function(){
      console.log("Hello");
      return true;
    }
  })

But the code gets never executed. Do you have any idea how to solve that ?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Now that’s it ! Perfect, thank you very much, exactly what i wanted !