title: Having trouble uploading image from Angular 8 to ASP.Netcore Web API
body: <p>I have spent the whole day trying to get this to work, I have looked at the following:</p>
  
  <ul>
  <li><p><a href="https://www.talkingdotnet.com/upload-file-angular-5-asp-net-core-2-1-web-api/" rel="nofollow noreferrer">https://www.talkingdotnet.com/upload-file-angular-5-asp-net-core-2-1-web-api/</a></p></li>
  <li><p><a href="https://code-maze.com/upload-files-dot-net-core-angular/" rel="nofollow noreferrer">https://code-maze.com/upload-files-dot-net-core-angular/</a></p></li>
  </ul>
  
  <p>and many more than I can count.</p>
  
  <p>All I want is to send an a form and an image. The errors am getting are:</p>
  
  <ul>
  <li><p>Missing content-type boundary</p></li>
  <li><p>Incorrect Content-Type</p></li>
  <li><p>The function evaluation requires all threads to run</p></li>
  </ul>
  
  <p>In angular</p>
  
  <pre><code>register(user: UserViewModel, logo: File) {
      // We use formData because we can't send file as an object
      const formData = new FormData();
  
      formData.append("user", JSON.stringify(user));
  
      formData.append("logo", logo);
  
      console.log(formData);
  
      return this.http.post&lt;UserRegisterViewModel&gt;(`${UserAPI.API_User}/${"register"}`, formData).pipe(map(user =&gt; {
  
        return user;
  
      }));
    }
  </code></pre>
  
  <p>Than my c# code looks like so</p>
  
  <pre class="lang-cs prettyprint-override"><code>[HttpPost, DisableRequestSizeLimit]
          [AllowAnonymous]
          [Route("register")]
          //[Consumes("application/json", "multipart/form-data")]
          public async Task&lt;IActionResult&gt; RegisterAsync()
          {
  
              IFormFile logo = null;
  
              try
              {
  
                  // Get the logo
                  logo = Request.Form.Files[0];
                  // Get the user json string
                  var userJson = Request.Form["user"];
  
  </code></pre>