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
I've faced the same issue, I was able to fix it by applying the 'Name' named parameter to FromForm attribute with name of the File field in the form. It specifies which field in the form to bind to the method parameter. Change your method signature as shown here.
[HttpPost("status")]
public async Task<BaseListResponse<MediaStorageModel>> MediaBrand([FromForm(Name ="file")] IFormFile file, int brandId)