1. 程式人生 > >springboot整合ueditor

springboot整合ueditor

@RequestMapping(value = "/admin/upload", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> imgUpload3(MultipartFile upfile) {
System.out.println("開始上傳");
Map<String, String> result = new HashMap<String, String>();
String path = "";
try {
path = fastDFSClientWrapper.uploadFile(upfile);
} catch (IOException e) {
System.out.println("富文字框圖片上傳錯誤");
// e.printStackTrace();
}
System.out.println(path);
File file = new File(path);
result.put("url", path);
result.put("size", String.valueOf(file.length()));
result.put("type",
file.getName().substring(file.getName().lastIndexOf(".")));
result.put("state", "SUCCESS");


return result;
}