type

UploadConfig

Validation and object-storage behavior for an upload collection.

Properties

PropertyTypeDescription
MaxFileSizeint64Accepted byte limit; zero uses the framework default and values above 256 MiB are rejected.
MimeTypes[]stringAllowed media types; empty accepts any supported type.
PrivateboolRequires authorized delivery instead of public object URLs.
ImageSizes[]ImageSizeDerived variants generated for supported image uploads.
MaxImageDimensionintMaxImageDimension scales a JPEG or PNG original wider or taller than this many pixels down to fit before it is stored. The scaled image replaces the original, including the private source later crops start from, and image sizes are made from it. Zero keeps originals at their uploaded size. It must be at least the width and height of every image size.

Full signature

type UploadConfig struct { // MaxFileSize is the maximum accepted upload size in bytes. Zero uses the // framework default; values above 256 MiB are rejected so one request cannot // bypass the process-wide upload work budget. MaxFileSize int64 // MimeTypes restricts uploads to the listed media types. Empty accepts any supported type. MimeTypes []string // Private requires a signed-in caller to download files, on top of the // collection's read access. Every download is checked against read access // and sent as private, no-store whether or not Private is set, so leave it // off when read access lets visitors download the files. Private bool // ImageSizes declares derived image variants generated from supported image uploads. ImageSizes []ImageSize // MaxImageDimension scales a JPEG or PNG original wider or taller than this // many pixels down to fit before it is stored. The scaled image replaces // the original, including the private source later crops start from, and // image sizes are made from it. Zero keeps originals at their uploaded // size. It must be at least the width and height of every image size. MaxImageDimension int }

Source core/config.go:347