I use: https://github.com/blueimp/jQuery-File-Upload (main plugin without adding ui)
I use data.context to link separate nodes to update the progress of each file download, but it will not update the last downloaded one. So, for example, if I select 4 files, they will be displayed on my page, and progress will work for the first 3 in the list, but not in the 4th. Regardless of the number selected, it is always the last on the list. (if only one item is selected, it works fine).
In addition, it also shows that it also does not update the corresponding progress bar.
Any ideas?
Here is my code:
$('.aws').fileupload({ limitMultiFileUploads: 1, dataType: 'html', add: function (e, data) { var file = data.files[0]; var fileDetails = '<tr><td>' + file.name + '</td><td class="progress"><span class="progress"><span class="js-progress-active progress-active"></span>' + '</span></td><td class="cancel-file"><a href="#" class="cancel-file-load-icon js-cancel-file">Cancel</a></td></tr>'; if ($('.file-list table tr:last').length > 0) { data.context = $('.file-list table tr:last').after(fileDetails); } else { data.context = $(fileDetails).appendTo('.file-list table'); } data.submit(); }, progress: function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); data.context.find('.js-progress-active').css( 'width', progress + '%' ).text(progress + '%'); } })
UPDATE Turns off the tr: last selector. therefore this does not work:
data.context = $('.file-list table tr:last').after(fileDetails);
but it does:
data.context = $(fileDetails).appendTo('.file-list table');
Stevo
source share