上传文件功能

This commit is contained in:
deepzz0
2016-12-18 00:16:06 +08:00
parent 3e50cfa248
commit 0b1e034346
8 changed files with 128 additions and 66 deletions
+21
View File
@@ -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)
}