一个简单的文件上传网站,专为本地和内网部署设计,支持跨设备传输。支持多种文件类型上传,具有安全验证、进度显示和跨平台兼容性。
A simple file upload website designed for local and intranet deployment. Supports multiple file types upload with security validation, progress display, and cross-platform compatibility.
- 🚀 简单易用 - 直观的拖拽上传界面 / Easy to Use - Intuitive drag-and-drop upload interface
- 🔒 安全可靠 - 文件类型验证和内容安全检查 / Secure & Reliable - File type validation and content security checks
- 📊 实时进度 - 上传进度实时显示 / Real-time Progress - Live upload progress display
- 🌐 跨平台 - 支持 Windows、macOS、Linux / Cross-platform - Supports Windows, macOS, Linux
- 🏠 本地部署 - 无需外部依赖,支持离线运行 / Local Deployment - No external dependencies, supports offline operation
- ⚙️ 灵活配置 - 丰富的配置选项和命令行参数 / Flexible Configuration - Rich configuration options and command-line parameters
- 🌍 国际化支持 - 支持中文和英文界面 / Internationalization - Supports Chinese and English interfaces
- Node.js 14.0.0 或更高版本 / Node.js 14.0.0 or higher
- 至少 512MB 可用内存 / At least 512MB available memory
- 支持的操作系统:Windows、macOS、Linux / Supported OS: Windows, macOS, Linux
-
下载项目 / Download Project
git clone <repository-url> cd file-upload-website
-
安装依赖 / Install Dependencies
npm install
-
启动服务器 / Start Server
方式一:使用 npm 脚本
npm start # 启动服务器 npm run daemon # 后台运行 npm run status # 检查状态 npm stop # 停止服务器
方式二:使用平台脚本
Windows:
start.bat # 启动服务器 start-daemon.bat # 后台运行 status.bat # 检查状态 stop.bat # 停止服务器
Unix/Linux/macOS:
./start.sh # 启动服务器 ./start-daemon.sh # 后台运行 ./status.sh # 检查状态 ./stop.sh # 停止服务器
-
访问网站 / Access Website
打开浏览器访问 / Open browser and visit:
http://localhost:3000
node bin/start.js [选项]
选项:
-p, --port <端口> 指定服务器端口 (默认: 3000)
-H, --host <地址> 指定服务器地址 (默认: 0.0.0.0)
-c, --config <文件> 指定配置文件路径
-u, --upload-path <路径> 指定文件上传目录
-s, --max-file-size <MB> 指定最大文件大小(MB)
-l, --log-level <级别> 指定日志级别 (debug|info|warn|error)
-d, --daemon 以守护进程模式运行
--verbose 显示详细输出PORT=3000 # 服务器端口
HOST=0.0.0.0 # 服务器地址
UPLOAD_PATH=./uploads # 上传目录路径
MAX_FILE_SIZE=104857600 # 最大文件大小(字节)
LOG_LEVEL=info # 日志级别默认配置文件:config/default.json
{
"server": {
"port": 3000,
"host": "0.0.0.0"
},
"upload": {
"path": "./uploads",
"maxFileSize": 104857600,
"maxConcurrent": 5,
"allowedTypes": [
"image/jpeg", "image/png", "image/gif",
"application/pdf", "text/plain"
]
},
"security": {
"enableRateLimit": true,
"maxRequestsPerMinute": 60,
"enableFileValidation": true
},
"logging": {
"level": "info",
"enableConsole": true,
"enableFile": true,
"logPath": "./logs"
}
}- 拖拽上传:将文件拖拽到上传区域
- 点击上传:点击上传区域选择文件
- 查看进度:实时查看上传进度
- 查看结果:上传完成后查看结果信息
- 图片:JPEG、PNG、GIF、WebP
- 文档:PDF、TXT、CSV、Word、Excel
- 其他:可通过配置文件自定义
- 默认最大文件大小:100MB
- 可通过配置文件或命令行参数调整
详细的部署指南请参考:
-
端口被占用
# 使用不同端口启动 npm start -- --port 8080 -
权限错误
# 检查上传目录权限 npm run validate -
配置错误
# 验证配置 npm run validate-verbose
- 控制台日志:启动时显示
- 文件日志:
logs/目录下 - 错误日志:
logs/error-YYYY-MM-DD.log
# 验证配置
npm run validate
# 测试平台兼容性
npm run test-platform
# 详细测试输出
npm run test-platform-verbose├── bin/ # 可执行脚本
│ ├── start.js # 启动脚本
│ ├── stop.js # 停止脚本
│ ├── status.js # 状态检查
│ ├── restart.js # 重启脚本
│ ├── validate-config.js # 配置验证
│ ├── test-platform.js # 平台测试
│ └── file-upload-server # 主入口点
├── src/ # 源代码
│ ├── server.js # 主服务器
│ ├── services/ # 服务模块
│ └── utils/ # 工具模块
├── public/ # 静态文件
│ ├── index.html # 主页面
│ └── js/ # 前端脚本
├── config/ # 配置文件
│ ├── default.json # 默认配置
│ └── config.js # 配置加载器
├── docs/ # 文档目录
├── uploads/ # 上传文件存储
├── logs/ # 日志文件(运行时创建)
├── start.bat # Windows 启动脚本
├── start.sh # Unix 启动脚本
└── package.json # 项目配置
MIT License
如有问题或建议,请提交 Issue 或联系开发团队。