Guest User

Untitled

a guest
Nov 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. // assume that form is bound to $form and file input is named image
  2. // @requires: jQuery, jQuery validate
  3.  
  4.  
  5. // an array of valid file types
  6. var whitelist = ['png','jpe?g','gif'];
  7.  
  8. $form.validate(
  9. rules : {
  10. image : {
  11. accept: whitelist.join('|');
  12. }
  13. },
  14. message : {
  15. image: {
  16. accept: "Please upload a valid file type."
  17. }
  18. }
  19. );
Add Comment
Please, Sign In to add comment