Posted By

vagrantradio on 02/16/10


Tagged

file check jquery extension


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

emregulcan
fenta23


JQUERY CHECK FILE EXTENSION


 / Published in: jQuery
 

  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  

You need to login to post a comment.