tomitrescak / meteor-uploads

MIT License
295 stars 41 forks source link

validateFile not working #176

Closed slade991 closed 8 years ago

slade991 commented 9 years ago

Hello i try meteo-uploads and tried to set up a server side validation however it doesn't seems to work. Here is validation code:

validateFile : function(file) { valids = ['image/jpeg', 'image/jpeg', 'image/png', 'image/gif']; if (valids.indexOf(file.type) === -1) { return false; } return true; }

False is returned but file is uploaded anyway...

tomitrescak commented 8 years ago

@slade991 I have to admit, by the moronic design I was expecitng true to return in case of error. I have flipped this condition and it will be fixed in the next release. Please let me know if it works for you. I will close this for now.

tomitrescak commented 8 years ago

Actually, I changed my mind, I reversed the functionality and updated the documentation. The validate function has to return the **Description of error". As a result, it is up to you what you want to tell the user.

So, no error .. function returns null. Error returns description of error.

Not so moronic after all ;)