Posts

Showing posts from January, 2016

FileUpload allow Only Image Format Validate in JQuery

$( 'input:file' ).change( function () {                 var ext = this .value.split( '.' ).pop();                 //   alert(ext);                 var FileExt = [ 'png' , 'jpg' , 'JPEG' ]                 if ($.inArray($( this ).val().split( '.' ).pop().toLowerCase(), FileExt) == -1) {                     var xl = "Please Select image Files"                     alert(xl);                     this .$find( 'input:file' ).dispose();                     return false ;                 }             });

Validate FileUpload Accept Only xlsx File

         $( function () {             $( 'input:file' ).change( function () {                 var ext = this .value.split( '.' ).pop();                 var FileExt = [ 'xlsx' ]                 if ($.inArray($( this ).val().split( '.' ).pop().toLowerCase(), FileExt) == -1) {                     var xl = "Please Select xlsx Format Files"                     alert(xl);                     this .$find( 'input:file' ).dispose();                     return false ;                 }             });         });