Meteor-Community-Packages / Meteor-CollectionFS

Reactive file manager for Meteor
MIT License
1.05k stars 237 forks source link

FS.Collection insert: file does not pass collection filters #620

Closed huntonas closed 9 years ago

huntonas commented 9 years ago

I have continued to get this error when trying to upload an image. Here is the code for the Images collection

 Images = new FS.Collection("images", {
    stores: [new FS.Store.FileSystem("images", {path:"~/.uploads"})],
filter: {
    allow: {
        contentTypes: ['images/*'],
        extensions: ['png','jpg','jpeg','gif']
    }
}
});

I have tried uploading png's and jpg's, but I keep getting the filter error. Not sure if there is somewhere else that I need to define the filters. This code is in /lib/images.js

The template code:

'change .image-upload': function(event, template) {
    FS.Utility.eachFile(event, function(file) {
        var fileObj = new FS.File(file);
        Images.insert(fileObj, function(err) {
            console.log(err);
        });
    });
}
aldeed commented 9 years ago

Should be image/*

huntonas commented 9 years ago

hate it when that happens

kjrhody commented 6 years ago

I know this is closed, but I'm getting the same error when trying to upload InDesign files even though the collection filter should be accepting them. I have noticed when I look at the log for the file, the type property is empty, but I've seen that the type SHOULD be application/x-indesign. My code:

HighResFiles = new FS.Collection("highResFiles", {
    stores: [highResStore, highResThumbStore],
    filter: {
        maxSize: 524288000, //500 MB in bytes
        allow: {
            contentTypes: [
                'image/*', 'application/pdf', 'application/octet-stream', 'application/postscript', 'application/msword',
                'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel',
                'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/illustrator',
                'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
                'application/x-indesign'
            ],
            extensions: ['png', 'gif', 'jpg', 'jpeg', 'tif', 'tiff', 'bmp', 'eps', 'svg', 'ps', 'pdf', 'psd', 'doc', 'docx', 'xls', 'xlsx', 'ai', 'ppt', 'pptx', 'indd', 'idml']
        }
    }
});