Luca Romagnoli
Luca Romagnoli

Reputation: 12455

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,   
        resize : {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?

Upvotes: 3

Views: 6281

Answers (3)

Ashutosh Jha
Ashutosh Jha

Reputation: 1513

uploader.destroy(); is enough to handle it

Upvotes: 1

jayarjo
jayarjo

Reputation: 16716

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');

Upvotes: 11

Rafay
Rafay

Reputation: 31033

$('#plupload_div').unbind();

does this help?

calling unbind() without args removes all handlers attached to the elements

Upvotes: 2

Related Questions