feat(upload): 实现文件上传功能

- 添加处理 multipart 表单的 Go 函数
- 创建用于文件上传的 HTML 表单页面
- 支持解析和显示上传文件的元数据- 实现多文件上传处理逻辑
- 添加城市和姓名的文本文件示例- 集成 Bootstrap 样式提升界面美观度
This commit is contained in:
2025-10-25 22:30:30 +08:00
parent 85fa81daef
commit 635cb0dbc0
3 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
<title>Pro Go</title>
<link href="bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="m-1 p-2 bg-primary text-white h2 text-center">
Upload File
</div>
<form method="post" action="/forms/upload" class="p-2" enctype="multipart/form-data">
<div class="form-group">
<label class="form-label">Name</label>
<input type="text" name="name" class="form-control"/>
</div>
<div class="form-group">
<label class="form-label">City</label>
<input type="text" name="city" class="form-control"/>
</div>
<div class="form-group">
<label class="form-label">File</label>
<input type="file" name="files" class="form-control" multiple/>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary mt-2">Upload</button>
</div>
</form>
</body>
</html>