@ResponseBody
public Json newdeploy(@RequestParam("file") CommonsMultipartFile file,
HttpServletRequest request) {
String fileName = file.getOriginalFilename();
String basePath = this.getClass().getClassLoader()
.getResource("/").getPath();
String path = basePath
+ CommonUtil.getDateForString() + "-" + fileName;
try {
File newFile = new File(path);
file.transferTo(newFile);
processService.saveNewDeploye(newFile, file.getOriginalFilename());
return JsonResult.sucess();
} catch (IOException e) {
e.printStackTrace();
}
return JsonResult.error("部署流程失败!");
}
springmvc 后台把图片以流的方式传给前台
最新推荐文章于 2023-02-28 16:52:23 发布