Jquery file upload submits form on upload

63 views Asked by At

I am using jquery-fileupload-rails gems to enable users to upload files as part of a form that has other inputs as well.

$(function () {
 $('#fileupload').fileupload({
    progressall: function (e, data) {
     $("#submit").off('click').on('click', function () {  
        data.submit();
     });
     var progress = parseInt(data.loaded / data.total * 100, 10);
     $('#progress .bar').css(
        'width', progress + '%');
     }
   });
});

the uploader works but the problem is that it submits the form as soon as file is uploaded. What I need is to upload the file but only submit when clicking the submit button.

I know there are a lot of similar questions but none seemed to offer a working solution for me. I really appreciate if anyone can help, it's been couple of hours now with no luck

0

There are 0 answers