file

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUploader added in v1.3.2

func AddUploader(name string, up UploaderGenerator)

AddUploader makes a uploader generator available by the provided theme name. If Add is called twice with the same name or if uploader is nil, it panics.

func SaveMultipartFile added in v1.3.2

func SaveMultipartFile(fh *multipart.FileHeader, path string) error

SaveMultipartFile used in a local Uploader which help to save file in the local path.

func Upload

func Upload(c UploadFun, form *multipart.Form) error

Upload receive the return value of given UploadFun and put them into the form.

Types

type LocalFileUploader

type LocalFileUploader struct {
	BasePath string
}

LocalFileUploader is an Uploader of local file engine.

func (*LocalFileUploader) Upload

func (local *LocalFileUploader) Upload(form *multipart.Form) error

Upload implements the Uploader.Upload.

type UploadFun

type UploadFun func(*multipart.FileHeader, string) (string, error)

UploadFun is a function to process the uploading logic.

type Uploader added in v1.3.2

type Uploader interface {
	Upload(*multipart.Form) error
}

Uploader is a file uploader which contains the method Upload.

func GetFileEngine

func GetFileEngine(name string) Uploader

GetFileEngine return the Uploader of given name.

func GetLocalFileUploader

func GetLocalFileUploader() Uploader

GetLocalFileUploader return the default Uploader.

type UploaderGenerator added in v1.3.2

type UploaderGenerator func() Uploader

UploaderGenerator is a function return an Uploader.

Jump to

Keyboard shortcuts

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