IFormFile always return null in asp.net core 2.1

前端 未结 11 1935
伪装坚强ぢ
伪装坚强ぢ 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:25

    Make sure the form is the correct enctype

    I also had to change how the Model bind works from the generated code:

    public async Task Edit([Bind("Text,Example")] Example example)
    

    to this code:

    public async Task Edit(Example example)
    

提交回复
热议问题