103 lines
2.6 KiB
Markdown
103 lines
2.6 KiB
Markdown
# 📁 文件管理服务
|
||
|
||
您的项目现在拥有了完整的文件管理功能,通过现代的Web界面和REST API提供。
|
||
|
||
## 🌐 访问方式
|
||
|
||
### 1. Web界面(推荐)
|
||
直接在浏览器中打开:
|
||
```
|
||
http://localhost:8001/public/file-manager.html
|
||
```
|
||
|
||
### 2. REST API
|
||
基础地址:
|
||
```
|
||
http://localhost:8001/api/v1/files
|
||
```
|
||
|
||
## ✨ 主要功能
|
||
|
||
### 🚀 文件操作
|
||
- 📤 **上传文件** - 拖拽上传,支持多文件
|
||
- 📥 **下载文件** - 单文件直接下载
|
||
- 📦 **文件夹压缩下载** - 一键下载整个文件夹为ZIP
|
||
- 📋 **批量下载** - 选择多个文件统一打包下载
|
||
- 📁 **创建文件夹** - 新建目录结构
|
||
- ✏️ **重命名** - 文件和文件夹重命名
|
||
- 🗑️ **删除** - 安全删除文件和文件夹
|
||
- 🔍 **搜索** - 快速搜索文件
|
||
- 📊 **文件信息** - 查看详细信息和预览
|
||
|
||
### 🎯 高级功能
|
||
- ☑️ **批量选择** - 支持全选和部分选择
|
||
- 📦 **批量操作** - 多文件同时处理
|
||
- 🎨 **现代界面** - 响应式设计,移动端友好
|
||
- ⚡ **实时操作** - 快速响应的用户体验
|
||
|
||
## 📚 API 使用
|
||
|
||
### 文件列表
|
||
```bash
|
||
curl "http://localhost:8001/api/v1/files/list?path=uploads"
|
||
```
|
||
|
||
### 上传文件
|
||
```bash
|
||
curl -X POST "http://localhost:8001/api/v1/files/upload" \
|
||
-F "file=@example.txt" \
|
||
-F "path=uploads"
|
||
```
|
||
|
||
### 下载文件
|
||
```bash
|
||
curl "http://localhost:8001/api/v1/files/download/uploads/example.txt" -o example.txt
|
||
```
|
||
|
||
### 文件夹压缩下载
|
||
```bash
|
||
curl -X POST "http://localhost:8001/api/v1/files/download-folder-zip" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"path": "uploads"}' \
|
||
-o uploads.zip
|
||
```
|
||
|
||
### 批量下载
|
||
```bash
|
||
curl -X POST "http://localhost:8001/api/v1/files/download-multiple-zip" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"paths": ["uploads", "data/123"], "filename": "batch.zip"}' \
|
||
-o batch.zip
|
||
```
|
||
|
||
### 其他操作
|
||
- `POST /api/v1/files/create-folder` - 创建文件夹
|
||
- `POST /api/v1/files/rename` - 重命名
|
||
- `POST /api/v1/files/delete` - 删除
|
||
- `GET /api/v1/files/search?query=keyword` - 搜索
|
||
- `GET /api/v1/files/info/{path}` - 获取文件信息
|
||
|
||
## 🎨 使用方法
|
||
|
||
### Web界面
|
||
1. 访问文件管理器
|
||
2. 拖拽文件到上传区域
|
||
3. 点击文件夹旁的"下载ZIP"
|
||
4. 使用"批量操作"模式进行多文件选择
|
||
|
||
### API集成
|
||
完整的REST API支持各种客户端集成,适合程序化文件操作。
|
||
|
||
## 🔧 技术特性
|
||
|
||
### 🛡️ 安全性
|
||
- 路径验证和限制
|
||
- 文件大小和数量限制
|
||
- 错误处理和用户友好提示
|
||
|
||
### ⚡ 性能
|
||
- 异步文件操作
|
||
- 内存中ZIP压缩
|
||
- 流式文件下载
|
||
|
||
现在您可以享受现代化的文件管理体验! |