How can I validate a filename after selecting it?

125 views Asked by At

I am using bootstrap file input from here:

https://github.com/kartik-v/bootstrap-fileinput

and I am trying to validate a filename after selecting a file. I tried this:

$("#mytest").fileinput({
    uploadUrl: "./upload.php",
    uploadAsync: true,      
    showPreview: false,    
    language: 'it',
    elErrorContainer: "#errorBlock"    

  })
.on('filebatchpreupload', function(event, data, id, index) {    
      return {
          message: "wrong file",
          data: {}
      };      
      }); 

and it works, but then it disable itself and I cannot do anything else.

I have noticed it does not happen if showPreview:true

I guess it's a bug? Any idea to what's happening and if it's there a workaround?

thank you!

0

There are 0 answers