How to dynamically change the plupload url

I have a Plupload setting to send to a PHP script to check the gal parameter, like:

$("#uploader").plupload({
  url : 'upload.php?gal='+$('#gallery').val()
});

This extracts the value from the drop-down list, but upon initialization, it takes the value of the drop-down list. I need to change this every time it is reset. I tried:

$("#gallery").change(function() {
  $('#uploader').data("uiPlupload").options.url = 'upload.php?gal='+$(this).val();
});

This changes the url for this value, however I think this is not a valid parameter, because although I see in Firebug that this is changing, it still uses the initialized value.

I also tried:

$("#uploader").bind('BeforeUpload', function(up, file) {
  up.settings.url = 'upload.php?gal='+$("#gallery").val();
});

It does not start at all.

Can someone shed some light on how I changed this?

Thank.

+5
source share
1 answer

Figured it out. You should get an instance of the bootloader, and then install in the settings, like:

$("#gallery").change(function() {
    var up = $('#uploader').plupload('getUploader');
    up.settings.url = 'upload.php?gal='+$(this).val()
});
+7
source

All Articles