Documentation ¶
Index ¶
Constants ¶
View Source
const MaxS3CreationTimeout = time.Duration(time.Second * 30)
View Source
const MaxUploadSize = 20 * 1024 * 1024 // 20MB
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { Logger *zap.Logger BucketName string BucketLocation string AccessKeyID string SecretAccessKey string UseSSL bool // Profiles available for this. Key is the profile name while // the value is an UploadProfile. Note that it might be empty. Profiles map[string]*UploadProfile // Client for executing hooks HooksClient *hooks.Client // Client name, must be set when using hooks because the name // is part of the hook URL. Name string }
type S3UploadClient ¶
type S3UploadClient struct {
// contains filtered or unexported fields
}
func NewS3UploadClient ¶
func NewS3UploadClient(endpoint string, s3Options Options) (*S3UploadClient, error)
func (*S3UploadClient) UploadFile ¶
func (s *S3UploadClient) UploadFile(w http.ResponseWriter, r *http.Request)
type UploadProfile ¶ added in v0.127.0
type UploadProfile struct { // Whether the profile requires authentication to upload a file RequireAuthentication bool // Maximum size of each file in bytes MaxFileSizeBytes int // Maximum number of files per upload MaxAllowedFiles int // Allowed mime types, case insensitive AllowedMimeTypes []string // Allowed file extensions, case insensitive AllowedFileExtensions []string // Optional JSON schema to validate metadata MetadataJSONSchema string // Whether to use the PreUpload middleware hook UsePreUploadHook bool // Whether to use the PostUpload middleware hook UsePostUploadHook bool }
UploadProfile specifies options like maximum file size and allowed extensions for a given upload profile
type UploadResponse ¶
type UploadResponse struct {
Files []UploadedFile `json:"Files"`
}
type UploadedFile ¶
type UploadedFile struct {
Key string `json:"key"`
}
Click to show internal directories.
Click to hide internal directories.