上传
1 | // 获取form文件 |
下载
1 | file, err := os.Open(attachment.Path) |
通过默认的net/http服务
1 | func main() { |
重写ServeHTTP方法
1 | type MyHandler struct {} |
重写http.Server
1 | // 定义全局变量 |
原生中间件编写
1 | package main |
1 | // 获取form文件 |
1 | file, err := os.Open(attachment.Path) |
1 | func main() { |
1 | type MyHandler struct {} |
1 | // 定义全局变量 |
1 | package main |