forked from all_user/stat_center
Initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ExamplePutObject() {
|
||||
file, err := os.OpenFile("/Users/mac/Desktop/abc.jpeg", os.O_RDONLY, 0655)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
filestat, err := file.Stat()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
path, err := PutObject(context.TODO(), "http://img.bbaazz.me/file/upload", filestat.Name(), file)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
log.Println("path", path, "err", err)
|
||||
|
||||
// Output:
|
||||
}
|
||||
Reference in New Issue
Block a user