I have setup Plupload to send to a PHP script checking for a parameter "gal" like:
我有安装Plupload发送到PHP脚本检查参数“gal”,如:
$("#uploader").plupload({
url : 'upload.php?gal='+$('#gallery').val()
});
This retrieves the value from a drop down, but it grabs the value of the drop down when initialized. I need to change this every time the drop down is changed. I tried:
这将从下拉中检索值,但在初始化时获取下拉值。每次下拉菜单改变时,我都需要改变这个。我试着:
$("#gallery").change(function() {
$('#uploader').data("uiPlupload").options.url = 'upload.php?gal='+$(this).val();
});
This is changes the url for this value, however I guess this isn't the correct parameter as even though I can see in Firebug that this changes, it still uses the initialized value.
这改变了这个值的url,但是我猜这不是正确的参数,即使我可以在Firebug中看到这个改变,它仍然使用了initialized值。
I have also tried:
我也试过:
$("#uploader").bind('BeforeUpload', function(up, file) {
up.settings.url = 'upload.php?gal='+$("#gallery").val();
});
This doesn't get triggered at all.
它根本不会被触发。
Can someone shed some light on how I would change this?
有人能解释一下我该如何改变吗?
Thanks.
谢谢。
1 个解决方案
#1
7
Figured it out. You have to get the uploader instance and then set in the settings like:
算出来。你必须获取上传者实例,然后设置如下:
$("#gallery").change(function() {
var up = $('#uploader').plupload('getUploader');
up.settings.url = 'upload.php?gal='+$(this).val()
});
#1
7
Figured it out. You have to get the uploader instance and then set in the settings like:
算出来。你必须获取上传者实例,然后设置如下:
$("#gallery").change(function() {
var up = $('#uploader').plupload('getUploader');
up.settings.url = 'upload.php?gal='+$(this).val()
});