ueditor uft-8 jsp版本配置
来源:互联网 发布:淘宝旗袍第一模特 编辑:程序博客网 时间:2024/05/22 13:33
1.前台html:
<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
var ue = UE.getEditor('editor');
<script type="text/javascript">
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
if (action == '/fileUpload/imgUpload') {
return 'http://127.0.0.1:8084/demo/fileUpload/imgUpload';
} else {
return this._bkGetActionUrl.call(this, action);
}
}
</script>
2.jsp/config.json
/* 上传图片配置项 */
"imageActionName": "/fileUpload/imgUpload", /* 执行上传图片的action名称 */
"imageFieldName": "upfile", /* 提交的图片表单名称 */
"imageMaxSize": 2048000, /* 上传大小限制,单位B */
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
"imageInsertAlign": "none", /* 插入的图片浮动方式 */
"imageUrlPrefix": "", /* 图片访问路径前缀 */
"imagePathFormat": "/ueditor/jsp/upl
java后台上传图片到ftp:
@ResponseBody
@RequestMapping(value = "/imgUpload", method = { RequestMethod.GET,
RequestMethod.POST })
public String imgUpload(HttpServletRequest request,
HttpServletResponse response,@RequestParam("upfile") MultipartFile[] files) throws IllegalStateException,
IOException {
response.setContentType("text/html;charset=UTF-8");
ReturnUploadImage rui = null;
final List<ReturnUploadImage> ruiList = new ArrayList<ReturnUploadImage>();
for (final MultipartFile file : files) {
// 当前上传文件的文件名称
String fileName = file.getOriginalFilename();
// 当前上传文件的文件类型
String fileType = file.getContentType();
// 当前上传文件的文件大小
Long fileSize = file.getSize();
// 当前上传文件的文件后缀
String suffix = fileName.indexOf(".") != -1 ? fileName
.substring(fileName.lastIndexOf("."),
fileName.length()) : null;
// 重命名上传后的文件名
String saveFileName = UUID.randomUUID() + suffix;
// 定义上传路径
String savePath = "/uploadCloud" + "/" + saveFileName;
FTPClientTemplate ftp = new FTPClientTemplate();
ftp.setHost(FtpConfigUtil.getHOST());
ftp.setPort(FtpConfigUtil.getPORT());
ftp.setUsername(FtpConfigUtil.getUsername());
ftp.setPassword(FtpConfigUtil.getPassword());
ftp.setBinaryTransfer(false);
ftp.setPassiveMode(false);
ftp.setEncoding("utf-8");
boolean ret = ftp.put(savePath, file.getInputStream(),
savePath);
rui = new ReturnUploadImage();// 这个是UEditor需要的返回值内容,UEditor要的返回值需要封装成Json格式
rui.setTitle(fileName);
rui.setOriginal(fileName);
rui.setState("SUCCESS");
rui.setUrl("http://111.231.110.149:8081/FTPfile/uploadCloud/"
+ saveFileName);
// rui.setUrl(savePath);
ruiList.add(rui);
}
String result = JSON.toJSONString(rui);// 这边就是为了返回给UEditor做的格式转换
response.getWriter().write(result);
return null;
}
- ueditor uft-8 jsp版本配置
- 个人博客配置百度Ueditor--jsp版本
- Spring mvc UEditor jsp版本
- UEditor 1.4.3 jsp配置
- ueditor 后端配置项没有正常加载,上传插件不能正常使用!jsp版本
- ueditor 后端配置项没有正常加载,上传插件不能正常使用!jsp版本
- ueditor jsp版本 后端配置项没有正常加载,上传插件不能正常使用!
- ueditor jsp版本 后台配置项无法加载解决方案--局域网内项目
- SSH项目ueditor插件jsp版本
- ueditor的jsp版本的使用方法
- ueditor的mini版本的jsp版本的使用方法
- Ueditor 1.3.5 JSP版配置
- jsp 引用配置 ueditor富文本编辑器
- Ueditor图片上传设置(1.4.3 JSP版本)
- UEditor (JSP 1.4.3版本) 集成到ssh框架中
- Ueditor图片上传设置(1.4.3 JSP版本)
- UEditor (JSP 1.4.3版本) 集成到ssh框架中
- ueditor编辑器图片上传添加水印-jsp版本
- 非编程人学Python,要注意哪些隐秘的错误认知?
- 智慧城市的建设该如何进行下去
- Mybatis逆向工程出现BigDecimal类型解决办法
- Apache Commons 系列简介 之 Lang
- SpringBoot
- ueditor uft-8 jsp版本配置
- crontab 打印错误小技巧
- 【牛腩】牛腩新闻发布系统总结
- easy-UI动态树点击文字实现展开关闭
- MSHFlexGrid与MSFlexGrid之间的区别
- Spring Cache自定义缓存格式
- 商城订单高并发下的数据安全
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe
- LeetCode #34