0

I form data into a form for angular like this:

const formDate = new FormData();
formDate.append("restaurant", JSON.stringify(this.restaurant));
formDate.append("file", this.file[0], this.file[0].name);

I can see through the developer panel in the browser that the form is submitting the correct data: enter image description here

But the controller accepts such data, and the file arrives normally: enter image description here

Controller:

  [HttpPost, DisableRequestSizeLimit]
  public IActionResult Post([FromForm]Restaurant restaurant, [FromForm]IFormFile file)
  {
    code...
  }
Betsq9
  • 135
  • 1
  • 3
  • 11
  • Are you able to manually POST data to your web api endpoint via postman or fiddler? – sam Jun 02 '21 at 13:49
  • See https://stackoverflow.com/questions/45017720/asp-net-core-and-formdata-binding-with-file-and-json-property – haim770 Jun 02 '21 at 13:55

0 Answers0