Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

File Validation #54

Open
xvendo opened this issue Jan 11, 2016 · 0 comments
Open

File Validation #54

xvendo opened this issue Jan 11, 2016 · 0 comments

Comments

@xvendo
Copy link

xvendo commented Jan 11, 2016

I have created an filter on a FSCollection and used context based validation to achieve an error message based on a wrong file type. Is there an way to publish an error message from the onInvalid function, and would It be possible to add an example to the project README?

Files = new FS.Collection("files", { stores: [new FS.Store.GridFS("filesStore")] });

var myFilter = {
maxSize: 2000000, // in bytes
allow: {
contentTypes: ['image/*'], //allow only images in this FS.Collection
extensions: ['png']
},
onInvalid: function (message) {
SimpleSchema.messages({fileError: "File Error!"});
Context1.addInvalidKeys([{name: "fileId", type: "fileError"}]);
}
};

Files.filters(myFilter);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant