upload

package module
v0.0.0-...-aa803ab Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

README

Kira

Upload pkg for kira framework

Getting Started


Getting Started

TODO

Documentation

Index

Constants

View Source
const (
	KB = 1 << 10
	MB = 1 << 20
	GB = 1 << 30
)

MB - one MB.

Variables

View Source
var Mimes = map[string]string{}/* 765 elements not displayed */

Mimes ...

Functions

This section is empty.

Types

type Upload

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

Upload - upload struct.

func New

func New(c *kira.Context) *Upload

New - return upload instance.

func (*Upload) Ext

func (u *Upload) Ext(types []string) *Upload

Ext - check if the file that we upload is one of this types.

func (*Upload) Form

func (u *Upload) Form(form string) *Upload

Form - set the form.

func (*Upload) ImageTo

func (u *Upload) ImageTo(itype string) *Upload

ImageTo - when this set convert the image to this type.

func (*Upload) IsImage

func (u *Upload) IsImage() *Upload

IsImage - set the upload file as an image.

func (*Upload) Name

func (u *Upload) Name(name string) *Upload

Name - set the name.

func (*Upload) NotRequired

func (u *Upload) NotRequired() *Upload

NotRequired - make the form not required.

func (*Upload) Path

func (u *Upload) Path(path string) *Upload

Path - set the path.

func (*Upload) Size

func (u *Upload) Size(size int64) *Upload

Size - to validate the file size.

func (*Upload) Upload

func (u *Upload) Upload() (Uploaded, error)

Upload - to upload one file. dst: ./storage/{dst}

type Uploaded

type Uploaded struct {
	Name string
	Mime string
	Size int64
	Path string
	// contains filtered or unexported fields
}

Uploaded an uploaded file representation.

Jump to

Keyboard shortcuts

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