title: MVC File Upload with more than one property
body: <p>There are links to explain <a href="http://rachelappel.com/upload-and-download-files-using-asp.net-mvc" rel="nofollow">how to upload a file in MVC</a>, but most of them only has a single input field (the file), and nothing else, which works with the following controller code:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Upload(HttpPostedFileBase file)
  ...
  </code></pre>
  
  <p>1) What should I do if I have a ViewModel with multiple properties, and the file is one of the required fields?</p>
  
  <pre><code>public class MyViewModel
  {
      // ...other properties...
  
      // debug value: {string[1]} = "&lt;filename-without-path&gt;"
      public object File { get; set; }
  }
  </code></pre>
  
  <p>When I debug, the value of <code>File</code> is <code>{string[1]}</code> with the file name, but without a path. I do not know what to do with that. I even tried to make the file of type <code>HttpPostedFileBase</code>, but that does not work.</p>
  
  <p>2) The other problem is that it "forgets" the file name, e.g. when there are other validation errors that should be fixed.</p>