go-admin: github.com/GoAdminGroup/go-admin/modules/file Index | Files

package file

import "github.com/GoAdminGroup/go-admin/modules/file"

Index

Package Files

file.go local.go

func AddUploader Uses

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 Uses

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 Uses

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

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

type LocalFileUploader Uses

type LocalFileUploader struct {
    BasePath string
}

LocalFileUploader is an Uploader of local file engine.

func (*LocalFileUploader) Upload Uses

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

Upload implements the Uploader.Upload.

type UploadFun Uses

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

UploadFun is a function to process the uploading logic.

type Uploader Uses

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

Uploader is a file uploader which contains the method Upload.

func GetFileEngine Uses

func GetFileEngine(name string) Uploader

GetFileEngine return the Uploader of given name.

func GetLocalFileUploader Uses

func GetLocalFileUploader() Uploader

GetLocalFileUploader return the default Uploader.

type UploaderGenerator Uses

type UploaderGenerator func() Uploader

UploaderGenerator is a function return an Uploader.

Package file imports 7 packages (graph) and is imported by 2 packages. Updated 2020-01-24. Refresh now. Tools for package owners.