I have the following ASP.NET Core 2.1 Api controller:
[Route("api/[controller]")]
[ApiController]
public class ImagesController : ControllerBase
{
[HttpPost("[action]")]
public async Task<IActionResult> Upload([FromForm]ICollection<IFormFile> files)
{ ... }
[HttpGet("thumbnails")]
public async Task<IActionResult> GetThumbNails()
{ ... }
Both the GET and POST actions worked with Postman.
However, the POST action would not work with the UI: the action would always receive a files parameter count of 0 (see here for full details of the fault).
I eventually fixed the fault by removing the [ApiController] attribute from the controller:
[Route("api/[controller]")]
//[ApiController]
public class ImagesController : ControllerBase
{ ... }
My question is why did the [ApiController] controller attribute prevent the POST method from receiving the files from the UI? What is happening here? Is it a routing problem?