Upload files and JSON in ASP.NET Core Web API

前端 未结 8 1276
夕颜
夕颜 2020-11-29 18:12

How can I upload a list of files (images) and json data to ASP.NET Core Web API controller using multipart upload?

I can successfully receive a list of files, upload

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 18:35

    I wanted to do the same using Vue frontend and .net core api. But for some weird reason IFormFile always returned null. So then I had to change it to IFormCollection and got it sorted out. Here is the code for anyone facing the same issue :)

    public async Task Post([FromForm]IFormCollection files)
    

提交回复
热议问题