IFormFile always return null in asp.net core 2.1

前端 未结 11 1852
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 11:52

Api method is looks like below

    [HttpPost]
    public async Task> MediaBrand(IFormFile file, int brandId)
         


        
11条回答
  •  广开言路
    2021-01-11 12:23

    The below code should work

    [HttpPost]
    public async Task> MediaBrand([FromQuery] int brandId, IFormFile file)
    {
        var files = new List();
        files.Add(file);
    
        var response = await this.Upload(files, "brand", brandId);
    
        return response;
    }
    

提交回复
热议问题