goo_upload

package
v1.0.61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

上传到本地

s := goo.NewServer()
s.GET("/upload/local", func(c *gin.Context) {
    filename, _ := goo_upload.Local("/upload").Upload(c)
    c.JSON(200, gin.H{"filename": filename})
})
s.Run(":18080")

上传到OSS

var (
	conf = goo_upload.OSSConfig{
		AccessKeyId:     "",
		AccessKeySecret: "",
		Endpoint:        "",
		Bucket:          "",
		Domain:          "",
	}
)

func main() {
	body, _ := ioutil.ReadFile("1.txt")
	url, _ := goo_upload.OSS.Upload("1.txt", body)
	fmt.Println(url)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OSS *gooOSS

Functions

func InitOSS

func InitOSS(config OSSConfig)

func Local

func Local(uploadDir string) *gooLocal

func NewOSS

func NewOSS(config OSSConfig) (*gooOSS, error)

Types

type OSSConfig

type OSSConfig struct {
	AccessKeyId     string `yaml:"access_key_id"`
	AccessKeySecret string `yaml:"access_key_secret"`
	Endpoint        string `yaml:"endpoint"`
	Bucket          string `yaml:"bucket"`
	Domain          string `yaml:"domain"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL