title: Request.Form.Files' threw an exception of type 'system.invalidoperationexception' with Incorrect Content Type 'application-json' in asp.net core 2.2
body: <p>I am using asp.net core 2.2 with angular 8. I am trying to upload files with some data to be saved using post method. Data is passing to controller but in controller Request.Form object is throwing error.</p>
  
  <p>It was working properly in asp.core 2.0 with angular 2. But I am trying to update this project to angular 8 with asp.net core 2.2. Now I am getting this error "Request.form.files' threw an exception of type 'system.invalidoperationexception'".</p>
  
  <p>Angular Service Code: </p>
  
  <pre><code>        saveNewMail(user: CommunicationActivityModel, files: File[]) {
          let body = JSON.stringify(user);
          let formData = new FormData();
          for (var i = 0; i &lt; files.length; i++) {
            formData.append('uploadedFiles', files[i]);
          }
           formData.append('user', body);
  
           let requestedUrl = this.baseUrl + 'SaveNewMail';
  
           return this.apiService.postFormData(requestedUrl, 
           formData).pipe(map(response =&gt; response));
  
     }
  </code></pre>
  
  <p>api.service Code:</p>
  
  <pre><code> postFormData(path: string, body: FormData): Observable&lt;any&gt; {
      return this.http.post(
        `${environment.api_url}${path}`,
         body
       ).pipe(catchError(this.formatErrors));
    }
  </code></pre>
  
  <p>Controller Code:</p>
  
  <pre><code>        [HttpPost]
          [Route("SaveNewMail")]
          public IActionResult SaveMail()
         {
              var files = Request.Form.Files;
              var communicationActivityString = Request.Form["user"];
              var communicationActivity = 
      JsonConvert.DeserializeObject&lt;CommunicationActivityViewModel&gt; 
     (communicationActivityString);
              var activityId = 
      _messageCenterService.SaveNewMail(communicationActivity, files);
                  return Ok(activityId);
              }
  </code></pre>