79313093

Date: 2024-12-28 02:21:14
Score: 1.5
Natty:
Report link

Adding the [Consumes("content-type")] defining the multipart/form-data as the content-type to your endpoint and removing the [FromBody] attribute from the mode parameter will fix this

[HttpPost]
[Consumes("multipart/form-data")]
public async Task<ActionResult> UploadRecipeImage(IFormFile front, IFormFile back, string mode)
{
    return Ok();
}

Related: How to set up a Web API controller for multipart/form-data

MS doc on Consumes: https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.consumesattribute?view=aspnetcore-9.0

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: wiseotter