@PostMapping(value = "/oss/endpoint/put-file-mp",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R<FileVO> putFileFroMP(@RequestPart("file") MultipartFile file) ;
/**
* 小程序上传文件
*
* @param file 文件
* @return ObjectStat
*/
@SneakyThrows
@PostMapping(value = "/put-file-mp",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<FileVO> putFileFroMP(@RequestPart("file") MultipartFile file) {
BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
FileVO fileVO = new FileVO();
BeanUtils.copyProperties(bladeFile, fileVO);
return R.data(fileVO);
}
注意 参数注解应使用@RequestPart。