views:

39

answers:

1

I have the following form (in brail):

<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>

Which posts to the following method signature on my controller:

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

When I post the form, I only get the file. The template var is null and I am not sure why. Does anyone see something obvious I am missing?

+1  A: 

You're missing the name attribute on the <select>:

<select name="template" id="template">
...
</select>
Mauricio Scheffer
thanks i knew it was something obvious i was missing.
NotMyself