title: I am trying to submit an object that contains some data and a file from the client app to the API app using ASP.CORE 5
body: <p>I have tried to submit an object from client app to an API which contains some data and a file, but I failed to do so.
  Here is the code:</p>
  <p>1- The model</p>
  <pre><code>public class ABC
  {
      public int Id { get; set; }
      public string Image { get; set; }
      public string Name { get; set; }
      [NotMapped]
      public IFormFile File { get; set; }
  }
  </code></pre>
  <p>2- The client app controller</p>
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Create(ABC aBC)
      {
          using (var httpClient = new HttpClient())
          {
              StringContent content = new StringContent(JsonConvert.SerializeObject(aBC), Encoding.UTF8, &quot;application/json&quot;);
              using (var response = httpClient.PostAsync(BaseURLManager.BaseUrl + &quot;ABCs&quot;, content))
              {
                  var apiResponse = response.Result.Content.ReadAsStringAsync();
                  aBC = JsonConvert.DeserializeObject&lt;ABC&gt;(apiResponse.Result);
              }
          }
          return View(aBC);
      }
  </code></pre>
  <p>3-  The API controller</p>
  <pre><code>    // POST: api/ABCs
      [HttpPost]
      public async Task&lt;ActionResult&lt;ABC&gt;&gt; PostABC([FromForm] ABC aBC)
      {
          _context.ABC.Add(aBC);
          await _context.SaveChangesAsync();
  
          return CreatedAtAction(&quot;GetABC&quot;, new { id = aBC.Id }, aBC);
      }
  </code></pre>
  <p>Could any one provide me a working code, I am using asp.core 5</p>
  <p>Thank you in advanced</p>