[ckan-dev] jquery.fileupload progress bar

Steven Matchett gosefroba22 at gmail.com
Wed May 8 13:47:14 UTC 2013


I am trying to implement a progress bar for resource uploads.  After
reading the docs for blueimp's jQuery-File-Upload it showed that you need
to setup an event handler progress or progressall.  I have done that as
shown below, but the event is only being triggered after the upload has
been completed.

file - >
 .../src/ckan/ckan/public/base/javascript/modules/resource-upload-field.js

setupFileUpload : function() {
var options = this.options;

this.upload.find('label').text(this.i18n('label'));
this.upload.find('input[type=file]').fileupload({
type : options.form.method,
paramName : options.form.file,
forceIframeTransport : true, // Required for XDomain request.
replaceFileInput : true,
autoUpload : false,
add : this._onUploadAdd,
send : this._onUploadSend,
done : this._onUploadDone,
fail : this._onUploadFail,
always : this._onUploadComplete,
progress : function(e, data) {
var prgrsPerc = parseInt(data.loaded / data.total * 100, 10);
console.log(prgrsPerc);
},
progressall : function(e, data) {
var prgrsPerc = parseInt(data.loaded / data.total * 100, 10);
console.log(prgrsPerc);
}
});
},
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130508/0ea25c1e/attachment.html>


More information about the ckan-dev mailing list