wangEditor显示文件上传失败
服务器显示文件是成功上传了并且out目录是有上传的图片的
相关截图:
相关代码:
1 2 3 4 5 6 7 8 9 10 | //实例化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); } |
相关代码:
1 2 3 4 5 6 7 8 9 10 11 12 | @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回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧