我正在使用 plupload,JQuery UI 实现。我正在尝试将其他参数传递给服务器,但我无法使其工作。应该很简单,在函数执行时参数已经设置好了,所以这应该不是问题。我试过这个:
function GetPlUploader(m)
{
$("#divOpplaster").plupload(
{
// General settings
runtimes: 'flash,html5,silverlight',
url: 'upload.php',
max_file_size: '10mb',
chunk_size: '1mb',
unique_names: true,
multipart: true,
multipart_params: [
{
'ordre': ordreibruk,
'mode': m}
],
// Specify what files to browse for
filters: [
{
title: "Bildefiler",
extensions: "jpg,gif,png,bmp"}
],
// Flash settings
flash_swf_url: 'plupload/js/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url: 'plupload/js/plupload.silverlight.xap',
init: {
FileUploaded: function(up, file, info)
{
// Called when a file has finished uploading
console.log('[FileUploaded] File:', file, "Info:", info);
}
}
});
console.log("Ordre: " + ordreibruk + ". Mode: " + m)
$("#divOpplaster").dialog(
{
autoOpen: false,
width: 650,
show: "fade",
hide: "fade"
})
$("#divOpplaster").dialog("open")
// Client side form validation
$('form').submit(function(e)
{
var uploader = $('#uploader').plupload('getUploader');
// Files in queue upload them first
if (uploader.files.length > 0)
{
// When all files are uploaded submit form
uploader.bind('StateChanged', function()
{
if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed))
{
$('form')[0].submit();
}
});
uploader.start();
}
else
alert('Du må velge minst én fil for opplasting.');
return false;
});
}
我也尝试在 $('form').submit 部分添加它:
uploader.bind('BeforeUpload', function(up)
{
up.settings.multipart_params =
{
'ordre': ordreibruk,
'mode': m
};
});
但无济于事。
我确定我忽略了一些非常简单的事情,但是什么?
亲切的问候,安德斯