@ResponseBody @RequestMapping(value = "/upload", method = RequestMethod.POST) public ImmutableMap<String, String> linkImgUpload( MultipartFile file, HttpServletRequest request) { if (file.isEmpty()) { return ImmutableMap.of("status", "0", "message", getMessage("global.uploadempty.message")); } Site site = (Site) (SystemUtils.getSessionSite()); String linkPath = PathFormat.parseSiteId(SystemConstant.LINK_RES_PATH, site.getSiteId() + ""); String realPath = HttpUtils.getRealPath(request, linkPath); SystemUtils.isNotExistCreate(realPath); String timeFileName = SystemUtils.timeFileName(file.getOriginalFilename()); try { file.transferTo(new File(realPath + "/" + timeFileName)); } catch (IOException e) { LOGGER.error("链接图片添加失败,错误:{}", e.getMessage()); return ImmutableMap.of("status", "0", "message", getMessage("link.uploaderror.message")); } return ImmutableMap.of( "status", "1", "message", getMessage("link.uploadsuccess.message"), "filePath", (linkPath + "/" + timeFileName), "contentPath", HttpUtils.getBasePath(request)); }