上传与权限

文件上传配置

# .env UPLOAD_PATH = uploads # php.ini upload_max_filesize = 20M post_max_size = 25M

目录权限

目录用途权限
runtime/缓存可写
uploads/上传可写
database/SQLite可写

安全上传检查

use app\common\service\FileService; // 检查文件 $check = FileService::check($file, 'image', 10485760); // 检查: 扩展名、大小、魔术字节 // 安全移动 $result = FileService::move($file, 'products', 'image');