Skip to content Skip to sidebar Skip to footer

Issues With JQuery Validation Plugin And Input File

I'm having issues with the jQuery Validation Plugin, the input file it's not recongnize by the method of the form. This is what I got: myform The class validate of the form is what

Solution 1:

Ajax requests cannot handle file input type, that is the reason you are not getting the file data in the server.

If you want to support only html5 FileAPI supported browsers then you can have a look at FormData to submit a file using ajax. You can read more about how to use FormData here and here

var form = document.getElementById('form-id');
var formData = new FormData(form);
$.ajax({
   url: '',
   data: formData
})

If you want to support cross browser then you need to look at a plugin like jQuery Form which simulates a ajax like form handling using iframes.


Post a Comment for "Issues With JQuery Validation Plugin And Input File"