title: Passing a HttpPostedFileBase to a controller method
body: <p>I'm just trying to create a form where I can enter a name and upload a file. Here's the view model:</p>
  
  <pre><code>public class EmployeeViewModel
  {
      [ScaffoldColumn(false)]
      public int EmployeeId { get; set; }
  
      public string Name { get; set; }
  
      public HttpPostedFileBase Resume { get; set; }
  }
  </code></pre>
  
  <p>My view:</p>
  
  <pre><code>@using (Html.BeginForm("Create", "Employees", FormMethod.Post))
  {   
      @Html.TextBoxFor(model =&gt; model.Name)
  
      @Html.TextBoxFor(model =&gt; model.Resume, new { type = "file" })
  
      &lt;p&gt;
          &lt;input type="submit" value="Save" /&gt;
      &lt;/p&gt;
  
      @Html.ValidationSummary()
  }
  </code></pre>
  
  <p>And my controller method:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Create(EmployeeViewModel viewModel)
  {
      // code here...
  }
  </code></pre>
  
  <p>The problem is that when I post to the controller method, the Resume property is null. The Name property gets passed just fine, but not the HttpPostedFileBase.</p>
  
  <p>Am I doing something wrong here?</p>