I'm using the jQuery File Upload plugin. I initialise the plugin like this:
var _this = this;
_obj = {
autoUpload: true,
maxFileSize: 1000000 // 1mb
};
FileProofer.$uploadform.fileupload(_obj)
.bind('fileuploadprogress', function (e, data) {
_this.handleFileProgress(data);
}).bind('fileuploadadded', function (e, data) {
_this.checkAddedFiles(data);
})
and then later I detach it with:
FileProofer.$uploadform.fileupload('destroy');
According to the documentation, this should remove all event listeners. However, when I run the same initialisation code again, I can see fileuploadadded is attached double (I use console.log inside _this.checkAddedFiles).
So it seems like the destroy call isn't really working. Am I doing something wrong here?
Some background info for those who are interested: The reason I'm reattaching the fileuploader is that I'm trying to reuse the same html for different products in a shoppingcart.
destroymethod, have you checked if it is really removing any added event listeners?