Meteor-Files: Error: [FilesCollection.users.avatars] Path "/data" is not writable! [401]

I’m afraid I don’t understand the documentation. This my initialization

export default Avatars = new FilesCollection({
  collectionName: 'users.avatars',
  storagePath: '/data',
  allowClientCode: false, // Disallow remove files from Client
  onBeforeUpload: function (file) {
    // Allow upload files under 10MB, and only in png/jpg/jpeg formats
    if (file.size <= 10485760 && /png|jpg|jpeg/i.test(file.extension)) {
      return true;
    } else {
      return 'Please upload image, with size equal or less than 10MB';
    }
  }
});

Where /data is located at the root of the project, with mode 774. The user running meteor is the same who created the directory. However, when I run the app, I get

Error: [FilesCollection.users.avatars] Path “/data” is not writable! [401]

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

I just tried data (with no leading slash) and it seems to work. This is actually contrary to Meteor’s specification that everything is absolute to the project root path. So, /data should not mean “from the root of the file system” !