jQuery file upload: Is it possible to trigger upload with a submit button?
jquery, jquery-plugins
Solution
if you have the button
<button id="up_btn">Upload</button>
You can try with
$('#fileupload').fileupload({
dataType: 'json',
add: function (e, data) {
$("#up_btn").off('click').on('click', function () {
data.submit();
});
},
});
EDIT: according to comments a better answer considere `off` to avoid duplicated requests. (also work `unbind`, I do not check if is `bind` and `unbind` but jquery team recommend `on` and `off` link since 1.7)
Problem
I'm using jQuery file upload for AJAX-based uploads. It always starts uploading after a file is selected. Is it possible to change the behavior to use the "submit"-button? I am aware of Issue #35, but the Option `beforeSend` seems to have been removed. I am using the Basic Plugin, not the full version. Maybe I should just switch to plain-XHR-based uploading as suggested there: jQuery Upload Progress and AJAX file upload.