Documentation ¶
Index ¶
- Variables
- func GetDir(path string, foderName string) (dir string, err error)
- func RandStringBytes(n int) string
- type AliOssConf
- type Uploader
- func (u *Uploader) Custom(httpContext *http.Request, acceptsExt []string, folder string) (url string, err error)
- func (u *Uploader) Default(httpContext *http.Request) (path string, err error)
- func (u *Uploader) OnlyAcceptsExt(httpContext *http.Request, acceptsExt []string, folder string) (url string, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AcceptsImgExt 图片类型 AcceptsImgExt = []string{"jpg", "png", "jpeg", "webp", "gif"} // AcceptsVideoExt 视频类型 AcceptsVideoExt = []string{"mov", "mp4", "avi"} // AcceptsAudioExt 音频类型 AcceptsAudioExt = []string{"mp3", "aac", "wav", "ogg"} //AcceptsOtherFileExt 文件类型 AcceptsOtherFileExt = []string{"pdf", "zip", "rar", "gz", "txt"} )
View Source
var DefaultGetFile = defaultGetFile
DefaultGetFile 默认从http请求读取文件流到方法
View Source
var DefaultUpload = defaultUpload
DefaultUpload 默认上传拷贝文件
Functions ¶
Types ¶
type AliOssConf ¶
type AliOssConf struct { Endpoint string `json:"endpoint"` AccessKeyID string `json:"access_key_id"` AccessKeySecret string `json:"Access_key_secret"` URL string `json:"url"` Bucket string `json:"bucket"` }
AliOssConf AliOssConf
type Uploader ¶
type Uploader struct { BaseDir string UploadMethod uploadMethod GetFile getFile }
Uploader Uploader
func (*Uploader) Custom ¶
func (u *Uploader) Custom(httpContext *http.Request, acceptsExt []string, folder string) (url string, err error)
Custom 自定义上传类型和目录
Click to show internal directories.
Click to hide internal directories.