i have file uploader handles large files. lots of times users cancel upload. there not appear way make browser cancel xhr post handling it. consequently, progress , complete events fire later , upload completes. presumably there must xhr object embedded in uploader somewhere call abort on, see nothing in api docs, or in console dump of uploader object.
if goal support only html5 uploader (and not iframe or flash version), can that:
- create new uploader widget following (code not tested, might need adjustment):
define(['dojo/_base/declare', 'dojox/form/uploader'], function(declare, uploader) { return declare([uploader], { xhrrequest: null, createxhr: function() { this.xhrrequest = this.inherited(arguments); return this.xhrrequest; }, cancel: function() { if (this.xhrrequest && this.xhrrequest.abort) { this.xhrrequest.abort(); } } }); });
- use new widget instead of
dojox.form.uploader
- call
cancel
method when want cancel upload.
but remember: work only html5 uploader.
Comments
Post a Comment