file

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Path upload directory
	Path = "./upload/"
	// Size upload limit
	Size = 5242880
	// Mime type allowed
	Mime = "image/"
)

Functions

func Upload

func Upload(file multipart.File, header *multipart.FileHeader, err error) (string, string, error)

Upload file

Types

type Local added in v0.3.0

type Local struct {
	// contains filtered or unexported fields
}

func New added in v0.3.0

func New(saveDir string, sizeLimit int, allowedTypes []string) *Local

New creates a new instance of Local file manager.

func (*Local) Delete added in v0.3.0

func (l *Local) Delete(name string) error

Delete uploaded file base on file name.

func (*Local) Dir added in v0.3.0

func (l *Local) Dir() string

Dir returns save path location.

func (*Local) Get added in v0.3.0

func (l *Local) Get(name string) (path string, err error)

GetFile get file path base on file name and its existence.

func (*Local) Save added in v0.3.0

func (l *Local) Save(fileReader io.Reader) (name string, err error)

Save saves bytes into file and returns an unique filename.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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