原来的代码如下:
@RequestMapping("/content/update.do")
public String update(Integer id, String title, String content,
@RequestParam MultipartFile image,
HttpServletRequest request,
HttpServletResponse response,
ModelMap model) throws Exception {
myContentMng.deleteImageOnServer(id);
CmsSite site = CmsUtils.getSite(request);
String contextPath = request.getContextPath();
String originalFileName = image.getOriginalFilename();
String extension = FilenameUtils.getExtension(originalFileName).toLowerCase(Locale.ENGLISH);
String fileUrl = fileRepository.storeByExt(site.getUploadPath(), extension, image);
cmsUserMng.updateUploadSize(CmsUtils.getUserId(request), Integer.parseInt(String.valueOf(image.getSize() / 1024)));
fileUrl = contextPath + fileUrl;
MyContent myContent = myContentMng.getById(id);
myContent.setTitle(title);
myContent.setContent(content);
myContent.setImgPath(fileUrl);
myCont