4 Star 16 Fork 7

qdbp/thirdparty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
README.md 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
qdbp 提交于 5年前 . update README.md.

我在ueditor里面提供了一个接口IStorageManager

这样Ueditor与任何实际的文件存储方式都可以组合

// 只需要继承IStorageManager并实现这两个方法:
// saveBinaryFile, saveFileByInputStream
FileStoreUeditorUploader implements IStorageManager {   
    // 存储到服务器某个目录
}
FastdfsUeditorUploader implements IStorageManager {   
    // 存储到FastDFS
}
AliyunUeditorUploader implements IStorageManager {   
    // 存储到阿里云
}

然后建一个UeditorController

@Controller
@RequestMapping("actions/common/ueditor")
public class UeditorController {
    @Autowired
    private IStorageManager uploader; // 在spring.xml文件中根据项目实际情况加载具体的实现类

    @RequestMapping("upload")
    public void upload(HttpServletRequest request, HttpServletResponse response) throws Exception {
        request.setCharacterEncoding("UTF-8");
        response.setHeader("Content-Type", "text/html");

        String rootPath = request.getServletContext().getRealPath("/");
        response.getWriter().write(new ActionEnter(uploader, request, rootPath).exec());
    }
}

在公共JS中修改ueditor的上传地址

window.UEDITOR_CONFIG.serverUrl = "actions/common/ueditor/upload?configPath=assets/libs/ueditor/jsp/config.json";

在spring.xml文件中根据项目实际情况加载具体的实现类

<bean class="com.xxx.FastdfsUeditorUploader" />  

ueditor maven repository

<dependency>
    <groupId>com.gitee.qdbp.thirdparty</groupId>
    <artifactId>ueditor</artifactId>
    <version>1.4.3.4</version>
</dependency>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/qdbp/thirdparty.git
git@gitee.com:qdbp/thirdparty.git
qdbp
thirdparty
thirdparty
master

搜索帮助