title: HttpPostedFileBase always return null in ASP.NET MVC
body: <p>I have a problem when I upload a file in ASP.NET MVC.
  My code is below:</p>
  
  <p>View:</p>
  
  <pre><code>@{
      ViewBag.Title = "Index";
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
  
  &lt;h2&gt;Index2&lt;/h2&gt;
  @using (Html.BeginForm("FileUpload", "Board", FormMethod.Post, new { enctype = "multipart/form-data" }))
  {
    &lt;input type="file" /&gt;
    &lt;input type="submit" /&gt;
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>[HttpPost]
  public ActionResult FileUpload(HttpPostedFileBase uploadFile)
  {
      if (uploadFile != null &amp;&amp; uploadFile.ContentLength &gt; 0)
      {
          string filePath = Path.Combine(Server.MapPath("/Temp"), Path.GetFileName(uploadFile.FileName));
          uploadFile.SaveAs(filePath);
      }
      return View();
  }
  </code></pre>
  
  <p>But uploadFile always returns null.
  Can anyone figure out why??</p>