feat(admin): 添加用户上传图片功能及相关页面
- 新增用户添加页面路由 /user/add 和文件上传处理路由 /user/doUpload - 实现文件上传表单页面 admin/useradd.html - 在 UserController 中添加 Add 方法渲染上传页面 - 在 UserController 中添加 DoUpload 方法处理文件上传及保存 - 在中间件添加 c.Next() 确保请求链继续执行
This commit is contained in:
21
templates/admin/useradd.html
Normal file
21
templates/admin/useradd.html
Normal 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 }}
|
||||
Reference in New Issue
Block a user