Javascript 在valums upload中将动态值传递给其他参数

Javascript 在valums upload中将动态值传递给其他参数,javascript,asp.net-mvc-3,file-upload,Javascript,Asp.net Mvc 3,File Upload,我正在使用asp.net mvc 3中的valums上载文件插件。我有两个下拉框和一个ajax valums上传文件按钮。我的视图中有以下代码: <link href="@Url.Content("~/Content/css/fileuploader.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Content/js/fileuploader.js")" type="text/ja

我正在使用asp.net mvc 3中的valums上载文件插件。我有两个下拉框和一个ajax valums上传文件按钮。我的视图中有以下代码:

<link href="@Url.Content("~/Content/css/fileuploader.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Content/js/fileuploader.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.7.2.js")" type="text/javascript"></script>


@using (Html.BeginForm("Upload", "AjaxUpload", FormMethod.Post, new { name = "form1" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Upload Wav File</legend>
         <div class="editor-label">
           @Html.Label("Select Language")
        </div>
        <div>

          @Html.DropDownList("Language1", (SelectList)ViewBag.lang)
      </div>
         <div class="editor-label">
           @Html.Label("Select Category")
        </div>


      <div>
          @Html.DropDownList("ParentCategoryID", ViewBag.ParentCategoryID as SelectList) 
      </div>

      <div id="file-uploader">
    <noscript>
        <p>
            Please enable JavaScript to use file uploader.</p>
    </noscript>
</div>
    </fieldset>
}


<script type="text/javascript">


    var uploader = new qq.FileUploader
    ({
        element: document.getElementById('file-uploader'),
        params: {
            param1: document.getElementById("Language1").value,
            param2: document.getElementById("ParentCategoryID").value
        },
        action: '@Url.Action("upload")', // put here a path to your page to handle uploading
        allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], // user this if you want to upload only pictures
        sizeLimit: 4000000, // max size, about 4MB
        minSizeLimit: 0, // min size
        debug: true
    });
</script>

提交其他值时,可以使用setParams方法

var uploader = new qq.FileUploader({
    onSubmit: function() {
        uploader.setParams({
            anotherParam: 'value' 
        });
    }
});

它在我的2.0版beta版中运行,如下所示:

var uploader = new qq.FileUploader({
    ......
    onSubmit: function() {
        this.params.xyzfield='dummyval';
        ......
    }
});

非常感谢,我在提交时没有注意到。现在我得到当前值
var uploader = new qq.FileUploader({
    ......
    onSubmit: function() {
        this.params.xyzfield='dummyval';
        ......
    }
});