mirror of
https://github.com/eiblog/eiblog.git
synced 2026-03-01 00:34:58 +08:00
上传文件功能
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Package main provides ...
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUpload(t *testing.T) {
|
||||
path := "/Users/chen/Desktop/png-MicroService-by-StuQ.png"
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
info, _ := file.Stat()
|
||||
url, err := Upload(info.Name(), info.Size(), file)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(url)
|
||||
}
|
||||
Reference in New Issue
Block a user