IFormFile always return null in asp.net core 2.1

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

    In my case it works as follows in net core

    Controller:

    [HttpPost]
    public IActionResult ReadFormFile([FromForm]IFormFile miCsv)
    {
    
    
    }
    

    Request body: Use as key the same name as the parameter

    Request Header: Use as Content-Type: multipart/form-data; boundary=xxxxxxxxxxx the boundary can be any value

提交回复
热议问题