title: Uploading File from console application to WebAPI
body: <p>I'm trying to post a file + some info to a WebApi I control. My problem is that I can't access the file on the WebAPI side, all other fields are OK.</p>
  
  <p>Here is my Console Application code</p>
  
  <pre><code>using (HttpClient client = new HttpClient())
  {
      using (MultipartFormDataContent content = new MultipartFormDataContent())
      {
          string filename = "my_filename.png";
  
          content.Add(new StringContent(DateTime.Now.ToString("yyyy-MM-dd")), "data");
  
  
          byte[] file_bytes = webClient.DownloadData($"https://my_url/my_file.png");
          content.Add( new ByteArrayContent(file_bytes), "file");
  
          string requestUri = "http://localhost:51114/api/File";
  
          HttpResponseMessage result = client.PostAsync(requestUri, content).Result;
          Console.WriteLine("Upload result {0}", result.StatusCode);
      }
  }
  </code></pre>
  
  <p>Here is my WebAPI Code</p>
  
  <pre><code> [HttpPost]
   public void Post(IFormFile file, [FromForm] DateTime data)
   {
       if (file == null || file.Length == 0)
       {
           Response.StatusCode = StatusCodes.Status400BadRequest;
           return;
       }
       // Never reaches this point..... file is null
  
   }
  </code></pre>
  
  <p>Any pointers on what I might be missing?</p>