Skip to content

Instantly share code, notes, and snippets.

@shohag-cse-knu
Created September 10, 2018 11:59
Show Gist options
  • Save shohag-cse-knu/d4c794efb45c60d835c4a692720d82da to your computer and use it in GitHub Desktop.
Save shohag-cse-knu/d4c794efb45c60d835c4a692720d82da to your computer and use it in GitHub Desktop.
jQuery PDF file validation
var fsize = jQuery(selector)[0].files[0].size;
var ftype = jQuery(selector)[0].files[0].type;
// alert(fsize+" "+ftype);
if(fsize>(1048576*3) || ftype != 'application/pdf') //do something if file size more than 1 mb (1048576)
{
return false;
}else
{
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment