Here\'s the plugin: https://github.com/blueimp/jQuery-File-Upload
I\'m having a problem getting the response I want from the plugin after uploading a file.
O
The "Empty file upload result" will occur when adding HTML (and in programmatical result DOM) objects to the template that are outside of the
This will result in the file(s) being uploaded correctly and for every uploaded file you will get the "Empty file upload result" once.
Seems to have to do something with the JS template engine.
This can be fixed in jquery.fileupload-ui,js, right after line 128
Original code:
// Callback for successful uploads:
done: function (e, data) {
var that = $(this).data('blueimp-fileupload') ||
$(this).data('fileupload'),
files = that._getFilesFromResponse(data),
template,
deferred;
if (data.context) {
data.context.each(function (index) { // LINE 128
var file = files[index] ||
{error: 'Empty file upload result'},
deferred = that._addFinishedDeferreds();
Add the following code after line 128:
if (!$(data.context[index]).hasClass(that.options.uploadTemplateId)) { return true; }
Resulting code:
// Callback for successful uploads:
done: function (e, data) {
var that = $(this).data('blueimp-fileupload') ||
$(this).data('fileupload'),
files = that._getFilesFromResponse(data),
template,
deferred;
if (data.context) {
data.context.each(function (index) { //LINE 128
if (!$(data.context[index]).hasClass(that.options.uploadTemplateId)) { return true; } // YOUR ADDED LINE
var file = files[index] ||
{error: 'Empty file upload result'},
deferred = that._addFinishedDeferreds();
Hope this helps others :)