mirror of
https://github.com/acepanel/panel.git
synced 2026-02-05 02:07:18 +08:00
37 lines
840 B
Go
37 lines
840 B
Go
package requests
|
|
|
|
import (
|
|
"mime/multipart"
|
|
|
|
"github.com/goravel/framework/contracts/http"
|
|
"github.com/goravel/framework/contracts/validation"
|
|
)
|
|
|
|
type Upload struct {
|
|
Path string `form:"path" json:"path"`
|
|
File *multipart.FileHeader `form:"file" json:"file"`
|
|
}
|
|
|
|
func (r *Upload) Authorize(ctx http.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func (r *Upload) Rules(ctx http.Context) map[string]string {
|
|
return map[string]string{
|
|
"path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`,
|
|
"file": "required",
|
|
}
|
|
}
|
|
|
|
func (r *Upload) Messages(ctx http.Context) map[string]string {
|
|
return map[string]string{}
|
|
}
|
|
|
|
func (r *Upload) Attributes(ctx http.Context) map[string]string {
|
|
return map[string]string{}
|
|
}
|
|
|
|
func (r *Upload) PrepareForValidation(ctx http.Context, data validation.Data) error {
|
|
return nil
|
|
}
|