feat(admin): 添加用户上传图片功能及相关页面

- 新增用户添加页面路由 /user/add 和文件上传处理路由 /user/doUpload
- 实现文件上传表单页面 admin/useradd.html
- 在 UserController 中添加 Add 方法渲染上传页面
- 在 UserController 中添加 DoUpload 方法处理文件上传及保存
- 在中间件添加 c.Next() 确保请求链继续执行
This commit is contained in:
2026-02-23 15:11:03 +08:00
parent ae36d59b68
commit a81fbb724e
4 changed files with 65 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
{{ define "admin/useradd" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>演示文件上传</h1>
<form action="/admin/user/doUpload" method="post" enctype="multipart/form-data">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" placeholder="用户名">
<br>
<label for="face">头 像:</label>
<input type="file" id="face" name="face">
<br>
<input type="submit" value="上传">
</form>
</body>
</html>
{{ end }}