## Api
@PostMapping("/uploadImg")
public AjaxResult uploadImg(@RequestParam("file") MultipartFile file){
return feign.uploadImg(file);
}
## Feign
@PostMapping(value = "/uploadImg",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxResult uploadImg(@RequestPart(value = "file") MultipartFile file);
## 图片上传服务
@PostMapping(value = "/uploadImg" ,consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxResult uploadImg(@RequestPart("file") MultipartFile fileUpload){
return service.uploadImg(fileUpload);
}
重点:
- @RequestPart("file")
- consumes = MediaType.MULTIPART_FORM_DATA_VALUE
报错信息:
- the request was rejected because no multipart boundary was found
- Current request is not a multipart request