Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // assume that form is bound to $form and file input is named image
- // @requires: jQuery, jQuery validate
- // an array of valid file types
- var whitelist = ['png','jpe?g','gif'];
- $form.validate(
- rules : {
- image : {
- accept: whitelist.join('|');
- }
- },
- message : {
- image: {
- accept: "Please upload a valid file type."
- }
- }
- );
Add Comment
Please, Sign In to add comment