I am trying to use the blueimp jQuery File Upload plugin, but without much success. I want my script to upload the file along with other form details when my user clicks the Save button. So far I have this:
$(document).ready(function() {
$('#custom-file-upload').fileupload({
dataType: 'json',
autoUpload: false,
url: get_current_url() + '/customFileUpload/',
done: function (e, data) {
//$.each(data.result, function (index, file) {
// $('<p/>').text(file.name).appendTo(document.body);
//});
},
change: function (e, data) {
$.each(data.files, function (index, file) {
$("#custom-file-upload-filename").text( file.name );
});
},
submit: function(e, data) {
console.log('submit event fired');
return false;
}
});
$('.edit-form .btn-submit').click(function(ev) {
ev.preventDefault();
})
});
So when my user clicks the "Attach File" button, a nice file browser pops up, they pick a file and click Open, and it shows the filename next to the Attach File button.
I do not know how to get it to submit my form now though. I've tried a bunch of different things and after reading the docs I still have no idea.