title: ASP MVC HttpPostedFile defined in model class
body: <p>You can define a property of the model as HttpPostedFile? I'm trying and always comes as a null value.
  This is the code</p>
  
  <pre><code>public class New
  {
      public string Title { get; set; }
  
      public DateTime PublishDate { get; set; }
  
      [UIHint("File")]
      public Image ImageHeader { get; set; }
  
  }
  
  public class Image
  {
      public string FooterText { get; set; }
  
      public HttpPostedFile File { get; set; }
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(New obj)
      {
          // OK it's populated 
          string FooterText = obj.ImageHeader.FooterText;
  
          // Error it is not populated! always == null
          HttpPostedFile ImagenFile = obj.ImageHeader.File;
  
          return View();
      }
  </code></pre>
  
  <p>Is it necessary to create a custom model binder for these cases? Or just the objects(httppotedfile) can be passed as parameters to the controller?</p>
  
  <p>Code</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(New obj, HttpPostedFileBase file)
      {
  
      }
  </code></pre>
  
  <p>Thanks!</p>