# ueditor-jsp-qiniu **Repository Path**: luolong/ueditor-jsp-qiniu ## Basic Information - **Project Name**: ueditor-jsp-qiniu - **Description**: 针对ueditor-1.4.3.1-utf8-jsp版本,修改图片视频等资源的上传存储位置,改为上传到七牛云储存; - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2017-06-04 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #ueditor-jsp-qiniu ### 简介 1. 对ueditor.jar源文件做了修改,来源https://github.com/fex-team/ueditor/tree/v1.4.3.1 2. 修改后支持上传图片、截图、视频、附件等文件到七牛云 ### 核心修改说明 1. 修改了com.baidu.ueditor.upload.StorageManager.java中的saveTmpFile(File tmpFile, String path)方法 2. 具体修改内容 ``` private static State saveTmpFile(File tmpFile, String path) { State state = null; File targetFile = new File(path); if (targetFile.canWrite()) { return new BaseState(false, AppInfo.PERMISSION_DENIED); } // 上传到七牛云存储 Start UploadManager uploadManager = QiNiuUploadManager.getUploadManager(); File tempFile = new File(path.trim()); Response response; try { response = uploadManager.put( tmpFile.getAbsolutePath(), tempFile.getName(), QiNiuUploadManager.getUpToken() ); } catch (QiniuException ex) { Logger.getLogger(StorageManager.class.getName()).log(Level.SEVERE, null, ex); return new BaseState(false, AppInfo.IO_ERROR); } // 上传到七牛云存储 End // try { // FileUtils.moveFile(tmpFile, targetFile); // } catch (IOException e) { // return new BaseState(false, AppInfo.IO_ERROR); // } state = new BaseState(true); state.putInfo("size", targetFile.length()); state.putInfo("title", targetFile.getName()); return state; } ``` ### 补充说明 1. qiniui_config.properties中的ak,sk,bucket需要修改为自己的参数 2. 修改后的版本将不支持多图上传中的在线管理和附件中的在线附件功能,对此较为遗憾