upload

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package upload 提供上传功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// 允许上传的文件大小
	Size int64 `json:"size" xml:"size,attr" yaml:"size" toml:"size"`

	// 允许上传的扩展名
	Exts []string `json:"exts" xml:"exts>ext" yaml:"exts" toml:"exts"`

	// 上传内容中表示文件的字段名
	Field string `json:"field" xml:"field" yaml:"field" toml:"field"`
}

Config 上传的配置项

func (*Config) SanitizeConfig

func (u *Config) SanitizeConfig() *web.FieldError

type Module

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

func Load

func Load(mod *cmfx.Module, prefix string, saver upload.Saver) *Module

Load 加载上传模块

mod 指定上传模块的基本信息; prefix 上传 API 的地址前缀,同时也可能是上传文件组成的静态文件服务的地址前缀;

func (*Module) Handle

func (m *Module) Handle(prefix *web.Prefix, api func(func(*openapi.Operation)) web.Middleware, conf *Config)

Handle 注册上传接口

func (*Module) Upload added in v0.8.17

func (m *Module) Upload(conf *Config) *upload.Upload

Upload 提供原始的 upload.Upload 对象

Directories

Path Synopsis
Package uploadtest 提供上传的测试用例
Package uploadtest 提供上传的测试用例

Jump to

Keyboard shortcuts

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