Unload plupload from a div
I'm using plupload with
$("#plupload_div").pluploadQueue({
// General settings
runtimes : 'flash,html5',
url : '/products/save_photo',
max_file_size : '10mb',
//chunk_size : '1mb',
unique_names : true,
resiz开发者_JAVA百科e : {width : 558, height : 418, quality : 90},
multipart: true,
multipart_params : {"photo[variant_id]" : variant_id, authenticity_token : atoken},
filters : [ {title : "Image files", extensions : "jpg,gif,png"}],
flash_swf_url : '/javascripts/plupload.flash.swf',
});
What i have to do to unload plupload from element #plupload_div?
You can do it as follows:
var uploader = $("#plupload_div").pluploadQueue();
uploader.destroy();
$("#plupload_div").remove();
This will unbind all the events and remove Plupload structure from the page.
Alternatively you might want to check Plupload UI Widget - another implementation of the Plupload Core API, which is skinnable (uses jQuery UI Themes), more flexible overall (has similar to UI widgets method and event model) and has public destroy method, that can be called like this:
$("#plupload_div").plupload('destroy');
$('#plupload_div').unbind();
does this help?
calling unbind() without args removes all handlers attached to the elements
uploader.destroy(); is enough to handle it
精彩评论