upload

package
v0.0.0-...-226d483 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileType

func GetFileType(fSrc []byte) string

get file type

Types

type AliYun

type AliYun struct {
	Driver
	// contains filtered or unexported fields
}

func (*AliYun) CheckPath

func (a *AliYun) CheckPath(path ...string) bool

check root path

func (*AliYun) MakeDir

func (*AliYun) MakeDir(path string) bool

make path directory

func (*AliYun) Save

func (*AliYun) Save(file interface{}, replace bool) bool

save file to path

type AliYunOption

type AliYunOption struct {
	Key         string
	Secret      string
	Bucket      string
	Endpoint    string
	Url         string
	SaveName    string
	AllowExtSet map[string]string
}

type Binary

type Binary struct {
	Driver
	// contains filtered or unexported fields
}

func (*Binary) CheckPath

func (*Binary) CheckPath(path ...string) bool

check root path

func (*Binary) InitBinary

func (*Binary) InitBinary(opt *Option) Uploader

func (*Binary) MakeDir

func (*Binary) MakeDir(path string) bool

make path directory

func (*Binary) Save

func (*Binary) Save(file interface{}, replace bool) bool

save file to path

type Driver

type Driver struct {
	SaveFileName string
	// contains filtered or unexported fields
}

*

@auth CrastGin
@date 2020-10

func (*Driver) GetError

func (c *Driver) GetError() string

get upload error

type Ftp

type Ftp struct {
	Driver
}

*

@auth CrastGin
@date 2020-10

func (*Ftp) CheckPath

func (*Ftp) CheckPath(path ...string) bool

check root path

func (*Ftp) MakeDir

func (*Ftp) MakeDir(path string) bool

make path directory

func (*Ftp) Save

func (*Ftp) Save(file interface{}, replace bool) bool

save file to path

type Local

type Local struct {
	Driver
}

func (*Local) CheckPath

func (l *Local) CheckPath(path ...string) bool

check root path

func (*Local) MakeDir

func (l *Local) MakeDir(path string) bool

make path directory

func (*Local) Save

func (l *Local) Save(file *multipart.FileHeader, replace bool) bool

save file to path

type Option

type Option struct {
	Mines        []string
	MaxSize      int64
	Exts         []string
	AutoSub      bool
	SubName      func() string
	RootPath     string
	SavePath     string
	SaveName     func() string
	SaveExt      string
	Replace      bool
	Hash         bool
	Callback     bool
	ErrText      string
	AliYunConfig *AliYunOption
}

type Uploader

type Uploader interface {
	CheckPath(path ...string) bool
	MakeDir(path string) bool
	Save(file *multipart.FileHeader, replace bool) bool
	GetError() string
}

func InitAliYun

func InitAliYun(opt *AliYunOption) Uploader

init aliYun driver

func InitFtp

func InitFtp(opt *Option) Uploader

init ftp driver

func InitLocal

func InitLocal(opt *Option) Uploader

init local driver

Jump to

Keyboard shortcuts

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