Documentation
¶
Overview ¶
Package upload validates and stores user-uploaded files in object storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
File is an uploaded file, decoupled from multipart so services and tests don't depend on HTTP types.
func FromHeader ¶
func FromHeader(fh *multipart.FileHeader) *File
FromHeader adapts a multipart upload; it returns nil for a nil header.
type Files ¶
type Files struct {
// contains filtered or unexported fields
}
Files saves and removes uploads.
func (*Files) Remove ¶
Remove deletes an object. Failures are logged, not returned: as on the classic site, a failed S3 delete never blocks the database change.
type Storage ¶
type Storage interface {
Put(ctx context.Context, key string, body io.Reader, size int64, contentType string) error
Delete(ctx context.Context, key string) error
Exists(ctx context.Context, key string) (bool, error)
PublicURL(key string) string
}
Storage is the object store (satisfied by *storage.Store).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package uploadtest provides an in-memory upload.Storage for tests.
|
Package uploadtest provides an in-memory upload.Storage for tests. |
Click to show internal directories.
Click to hide internal directories.