0

我有以下表格(盲文):

<form method="post" enctype="multipart/form-data" action="${UrlHelper.For({@action:'Upload'})}">
<p><b>Select Template:</b> &nbsp;
  <select id="template">
        <option selected>Select One..</option>
        <option value="Research">Research</option>
    </select>
</p>
<br/>
<p><b>Download Worksheet:</b> &nbsp; <a id="downloadLink">Worksheet</a></p>
<br/>
<p><b>Research Item Upload</b></p>
  <fieldset>
    <legend>Upload Research Items File</legend>

    <label for="file">File</label>
    <input type="file" name="file" size="80" accept="application/vnd.ms-excel,application/excel,application/x-msexcel" />
    <br />

    <input type="submit" value="Upload" />
  </fieldset>
</form>

在我的控制器上发布到以下方法签名:

[AccessibleThrough(Verb.Post)]
public UploadResults Upload(string template, [HttpPostedFileAdapterBinder] IHttpPostedFileAdapter file) {}

当我发布表格时,我只得到文件。模板 var 为空,我不知道为什么。有没有人看到我遗漏的明显东西?

4

1 回答 1

1

您缺少以下name属性<select>

<select name="template" id="template">
...
</select>
于 2010-03-26T15:45:00.233 回答