#jQuery fileupload for dynamically added input field

Updated September 2, 2015 ‚óŹ 7,515 views

jQuery fileupload from Blueimp is one of the good file upload jQuery Ajax classes. I used this class in the development of this website.

To make it work for dynamically added input field use the jQuery live() function. This attach an event handler for all elements which match the current selector, now and in the future.


$('#fileupload').live('click', function(e) {
        url: '',
        type:'post',dataType: 'json',autoUpload: false,
        formData: {},
        add: function(e, data, textStatus){
            .success(function (result, textStatus, jqXHR) {})
            .error(function (jqXHR, textStatus, errorThrown) {})
            .complete(function (result, textStatus, jqXHR) {});
        progress: function (e, data, jqXHR) {
        done: function (e, data) {


Sort by Best Controversial New

Thank you so much. I have spent a lot of time trying to get the fileupload to work with dynamic vars until I found this post.

cami · 7 years ago
permalink · reply (0)

Fantastic! Thank you very much!

Prakash1 · 8 years ago
permalink · reply (0)

Thanks for this tip! I've been wondering why the hell the jQuery fileupload wasn't working.

Ronn · 8 years ago
permalink · reply (0)

Our Terms of Use and Privacy Policy have changed.
By continuing to use this site, you are agreeing to the new Privacy Policy and Terms of Service.