Api method is looks like below
[HttpPost]
public async Task<BaseListResponse<MediaStorageModel>> MediaBrand(IFormFile file, int brandId)
{
var files = new List<IFormFile>();
files.Add(file);
var response = await this.Upload(files, "brand", brandId);
return response;
}
Upgrade my dotnet core from 2.0 to 2.1 thie become not working, can anyone help about this. What going wrong
[ApiController]
attribute? That attribute, among other things, switches the default binding source fromFromForm
toFromBody
, so if you need to actually acceptmultipart/form-data
orx-www-urleconded
request bodies, you need to add[FromForm]
to the param. – Chris Pratt[FromForm(Name = "")] IFormFile file
attribute and it worked for me. – Mohammad Taherian