I have input
elements in my html page. When user presses the submit button, it being binded to the click
even in jquery and the data is being validated and then send to server using AJAX. The problem is, I have a file
field. So how to initiate the uploading of the file via the code using AJAX ?
Sample code:
$(function(){
$('#btnSubmit').on('click', function(){
// validate fields, make some processing on the data, etc.
// then send to server using AJAX...
$.ajax({
//....
});
// after submitting the above data or along with it, I want the picture uploaded(without user having to press upload button or anything)
});
});
How it can be done?