blueimp/jQuery-File-Upload — Issue #888: send callback: iframe set to 100% progress, use progress callback?
Author: Zauberfisch
Created: 2011-12-17 01:19:34+00:00
State: open

in the send callback you set the progress to 100% if iframe is used, there is nothing wrong with that, but wouldn't it be better to use the progress callback for that?
In my case, I have overwritten progress to display more progress infos, now I also have to overwrite send for it as well.

https://github.com/blueimp/jQuery-File-Upload/blob/935805821f308c796c03d3c1f018d6414dd540cd/jquery.fileupload-ui.js#L76

so how about:

send: function (e, data) {
if (!data.isValidated) {
var that = $(this).data('fileupload');
if (!data.isAdjusted) {
that._adjustMaxNumberOfFiles(-data.files.length);
}
if (!that._validate(data.files)) {
return false;
}
}
if (data.context && data.dataType &&
data.dataType.substr(0, 6) === 'iframe') {
// Iframe Transport does not support progress events.
// In lack of an indeterminate progress bar, we set
// the progress to 100%, showing the full animated bar:
data.total = 1;
data.loaded = 1;
that.progress(e, data); // or how ever you access progress from within here
}
},

same for start and stop with progressall
https://github.com/blueimp/jQuery-File-Upload/blob/935805821f308c796c03d3c1f018d6414dd540cd/jquery.fileupload-ui.js#L195
https://github.com/blueimp/jQuery-File-Upload/blob/935805821f308c796c03d3c1f018d6414dd540cd/jquery.fileupload-ui.js#L200