wangEditor显示文件上传失败
服务器显示文件是成功上传了并且out目录是有上传的图片的
相关截图:

相关代码:
//实例化wangEditor富文本编辑器 editor = new wangEditor(this.$refs.editor); //设置上传图片的地址 editor.customConfig.uploadImgServer = '/book/management/upload';//设置图片上传地址 //默认上传时使用的参数名 editor.customConfig.uploadFileName = 'img';//设置图片上传参数 editor.create();//创建wangEditor //设置初始内容 editor.txt.html(this.form.description); }
相关代码:
@PostMapping("/upload")相关代码:
public Map upload(@RequestParam("img") MultipartFile file, HttpServletRequest request) throws IOException {
String uploadPath = request.getServletContext().getResource("/").getPath()+"/upload/";
SimpleDateFormat sdft = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String format = sdft.format(new Date());
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
file.transferTo(new File(uploadPath+format+suffix));
Map result = new LinkedHashMap();
result.put("erron",0);
result.put("data",new String[]{"/upload/"+format+suffix});
return result;
}
请老师看一下这是什么问题
37
收起
正在回答 回答被采纳积分+1
1回答
2023版Java工程师
- 参与学习 人
- 提交作业 8788 份
- 解答问题 9886 个
综合就业常年第一,编程排行常年霸榜,北上广深月薪过万! 不需要基础,无需脱产即可学习,只要你有梦想,想高薪! 全新升级:技术栈升级(包含VUE3.0,ES6,Git)+项目升级(前后端联调与功能升级)
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星