JQUERY CHECK FILE EXTENSION


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if (! (extension && /^(jpg|png|jpeg|gif|zip|xls|xlsx|csv|txt|tif|tiff|pdf|doc|eps)$/.test(extension))){
  2. // extension is not allowed
  3. $("<span class='error'>Error: Not a valid file extension</span>").appendTo("#file_holder .files");
  4. // cancel upload
  5. return false;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.