title: File upload using Asp.Net Core Web API file is always null
body: <p>I am implememting file upload using Angular 2 with ASP.NET core Web API to handle the request.</p>
  
  <p>My html code looks like :</p>
  
  <pre><code>&lt;input #fileInput type="file"/&gt;
  &lt;button (click)="addFile()"&gt;Add&lt;/button&gt;
  </code></pre>
  
  <p>and the angular2 code </p>
  
  <pre><code>addFile(): void {
      let fi = this.fileInput.nativeElement;
      if (fi.files &amp;&amp; fi.files[0]) {
          let fileToUpload = fi.files[0];
          this.documentService
              .uploadFile(fileToUpload)
              .subscribe(res =&gt; {
                  console.log(res);
          });
      }
  }
  </code></pre>
  
  <p>and the service looks like</p>
  
  <pre><code>public uploadFile(file: any): Observable&lt;any&gt; {
      let input = new FormData();
      input.append("file", file, file.name);
      let headers = new Headers();
      headers.append('Content-Type', 'multipart/form-data');
      let options = new RequestOptions({ headers: headers });
      return this.http.post(`/api/document/Upload`, input, options);
  }
  </code></pre>
  
  <p>and the controller code </p>
  
  <pre><code>[HttpPost]
  public async Task Upload(IFormFile file)
  {
      if (file == null) throw new Exception("File is null");
      if (file.Length == 0) throw new Exception("File is empty");
  
      using (Stream stream = file.OpenReadStream())
      {
          using (var binaryReader = new BinaryReader(stream))
          {
              var fileContent = binaryReader.ReadBytes((int)file.Length);
              //await this.UploadFile(file.ContentDisposition);
          }
      }
  }
  </code></pre>
  
  <p>My RequestHeader looks like </p>
  
  <pre><code>POST /shell/api/document/Upload HTTP/1.1
  Host: localhost:10050
  Connection: keep-alive
  Content-Length: 2
  Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJDb3JyZWxhdGlvbklkIjoiZDZlNzE0OTUtZTM2MS00YTkxLWExNWUtNTc5ODY5NjhjNDkxIiwiVXNlcklkIjoiMSIsIlVzZXJOYW1lIjoiWjk5OTkiLCJXb3Jrc3BhY2UiOiJRc3lzVFRAU09BVEVNUCIsIk1hbmRhbnRJZCI6IjUwMDEiLCJDb3N0Q2VudGVySWQiOiIxMDAxIiwiTGFuZ3VhZ2VDb2RlIjoiMSIsIkxhbmd1YWdlU3RyaW5nIjoiZGUtREUiLCJTdGF0aW9uSWQiOiI1NTAwMSIsIk5hbWUiOiJJQlMtU0VSVklDRSIsImlzcyI6InNlbGYiLCJhdWQiOiJodHRwOi8vd3d3LmV4YW1wbGUuY29tIiwiZXhwIjoxNDk1Mzc4Nzg4LCJuYmYiOjE0OTUzNzUxODh9.5ZP7YkEJ2GcWX9ce-kLaWJ79P4d2iCgePKLqMaCe-4A
  Origin: http://localhost:10050
  User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
  Content-Type: multipart/form-data
  Accept: application/json, text/plain, */*
  Referer: http://localhost:10050/fmea/1064001/content
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.8
  </code></pre>
  
  <p>The issue I am facing is that the file is always null in the controller.</p>
  
  <p>Please some one help me in figuring out the issue.</p>
  
  <p>Thanks in advance.</p>