4 Star 18 Fork 6

河蟹堡 / spring-elfinder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

spring-elfinder

简单的文件管理工具,基于springboot2,主要方便集成到项目中去,方便浏览系统文件,如日志、系统定时生成静态页面等

关于权限问题,不在该项目的考虑范围内,自己拦截相关URL即可,也可主动继承ElfinderController实现。集成的md文档编辑器,方便编辑普通文本文件; 相关页面调用http接口时,如果localstorage有token或者authorization时,会自动加入的ajx的header上;并添加了执行结束后的消息订阅, 方便在文件操作(如:文件上传、删除、压缩、下载)完成后,进行相关业务处理,只要继承AbstractCmdObserver抽象类即可。

如何添加

<dependency>
    <groupId>com.github.doobo</groupId>
    <artifactId>elfinder-api</artifactId>
    <version>1.5</version>
</dependency>

请求示例

文件列表

保存文件

PUT:http://localhost:8080/elfinder/connector
传参数:
cmd:put
target:A_c3RhdGljL3NmMS9hcnRpY2xlLm1pbi5qcw_E_E
encoding:UTF-8
content:保存内容

创建目录,并返回目录hast值,方便上传文件时指定目录
http://localhost:8080/elfinder/connector?cmd=mkdir&name=%08abc&target=A_&reqid=178b69b73bdda

基本配置

#添加这个UTF-8对中文文件的支持
spring:
  #大文件上传
  servlet:
    multipart:
      max-file-size: 10GB
      max-request-size: 30GB
      
file-manager:
  start: true
  thumbnail:
    width: 80 # 缩略图宽
  volumes:
    - Node:
      source: fileSystem # 暂时只支持本地文件系统
      alias: 系统目录 # 目录别名
      path: data # 映射目录
      isDefault: true # 是否默认打开
      locale:
      constraint:
        locked: false # 文件夹是否锁定
        readable: true # 是否可读
        writable: true # 是否可写
#    - Node:
#      source: aliyunoss
#      alias: 阿里云 # 目录别名
#      path: moore-test1 #bucketName
#      isDefault: false # 是否默认打开
#      locale:
#      constraint:
#        locked: false # 文件夹是否锁定
#        readable: true # 是否可读
#        writable: true # 是否可写
#      aliyunDriverConfig:
#        endpoint: "oss-cn-beijing.aliyuncs.com"
#        #bindedDomain: "cdn-bk1.origocoffee.com"
#        accessKeyId: ENC(******)
#        accessKeySecret: ENC(******)

#是否启用ElfinderController,可自主实现
elfinder:
  start: true
-- 默认配置文件
manager-default.yml

获取文件上传的系统路径


public static VolumeHandler findTarget(ElfinderStorage elfinderStorage, String hash) {
    Target target = elfinderStorage.fromHash(hash);
    if (target == null) {
        return null;
    }
    return new VolumeHandler(target, elfinderStorage);
}
VolumeHandler handler = vo.getVolumeHandlerByHash(hash);
//文件存放的系统路径
String name = handler.getTarget().toString();

参考文献

该项目参考了:

  1. https://gitee.com/boyuan2000cn/springboot2-elfinder
MIT License Copyright (c) 2020 boyuan2000cn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

简单的文件管理工具,基于springboot,主要方便集成到项目中去,浏览文件,如日志、定时生成静态页面等 展开 收起
Java 等 5 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/doobo/spring-elfinder.git
git@gitee.com:doobo/spring-elfinder.git
doobo
spring-elfinder
spring-elfinder
master

搜索帮助