title: File upload in ASP.NET Core 2 razor pages
body: <p>I'm trying to do a simple file upload in asp.net core 2 razor pages.  I have the code below.  Please realize that it is imcomplete.  When i run in my VS2017, I check my FileUpload object, and it is unfortunately null.  I would hope that it is something besides null and I could create a stream to get some data out of it.  However, with the object being null, I would suspect that I do not have something tied together correctly.  Any thoughts are appreciated.  Thanks.</p>
  
  <p>Code behind cs:</p>
  
  <pre><code>public class PicturesModel : PageModel
  {
      public PicturesModel()
      {
  
      }
      [Required]
      [Display(Name = "Picture")]
      [BindProperty]
      public IFormFile FileUpload { get; set; }
  
      public async Task OnGetAsync()
      {
  
      }
  
      public async Task&lt;IActionResult&gt; OnPostAsync()
      {
          //FileUpload is null
          return RedirectToPage("/Account/Pictures");
      }
  }
  </code></pre>
  
  <p>front end cshtml file;</p>
  
  <pre><code>&lt;form method="post" enctype="multipart/form-data"&gt;
      &lt;label asp-for="FileUpload"&gt;&lt;/label&gt;
      &lt;input type="file" asp-for="FileUpload" id="file" name="file" /&gt;
      &lt;input type="submit" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>