SpringBoot2.0 整合 FastDFS 中间件,实现文件分布式管理( 八 )

@RequestMapping(value = "http://www.veick.cn/uploadFile",headers="content-type=multipart/form-data", method = RequestMethod.POST)

public ResponseEntity uploadFile (@RequestParam("file") MultipartFile file){

String result ;

try{

String path = fileDfsUtil.upload(file) ;

if (!StringUtils.isEmpty(path)){

result = path ;

} else {

result = "上传失败" ;

}

} catch (Exception e){

e.printStackTrace() ;

result = "服务异常" ;

}

return ResponseEntity.ok(result);

推荐阅读