UploadOption uses ConstantsTrait
Enumeration of the option keys accepted by the upload helpers ({@see oihana\controllers\traits\UploadTrait}).
Tags
Table of Contents
Constants
- ALLOWED_MIME_TYPES : string = 'allowedMimeTypes'
- Whitelist of allowed MIME types (array of strings or arrays of strings).
- CLIENT_FILENAME : string = 'clientFilename'
- Store the file under the name the client gave it (bool). Default: false — a random name.
- EXTENSIONS : string = 'extensions'
- Extensions to use for some MIME types (array of `type => '.ext'`), read before the catalogue of `oihana\files\enums\FileMimeType` — for a type it does not know, or to prefer one of several (`[ 'audio/x-wav' => '.wav' ]`). Types are compared by their reference name (`oihana\files\normalizeMimeType()`) ; an extension must be a dot followed by letters and digits.
- FILENAME : string = 'filename'
- The name of the stored file (single upload only). Default: a random name.
- MAX_SIZE : string = 'maxSize'
- Maximum allowed file size in bytes. Larger uploads are rejected. Default: no limit.
- OVERWRITE : string = 'overwrite'
- Whether an existing target file may be overwritten. Default: false.
Constants
ALLOWED_MIME_TYPES
Whitelist of allowed MIME types (array of strings or arrays of strings).
public
string
ALLOWED_MIME_TYPES
= 'allowedMimeTypes'
When set, the type read from the content is validated with oihana\files\validateMimeType()
before the file takes its place ; a refused file is removed.
CLIENT_FILENAME
Store the file under the name the client gave it (bool). Default: false — a random name.
public
string
CLIENT_FILENAME
= 'clientFilename'
The part before the extension is cleaned by oihana\core\strings\slugify() (no leading dot,
no dot inside, ASCII lower-case, at most 200 characters ; nothing left gives a random name),
and the extension is the one of the type read from the content — kept when the client's
matches, replaced otherwise, added when missing. A name already taken is numbered
(photo-2.jpg), unless self::OVERWRITE is set.
EXTENSIONS
Extensions to use for some MIME types (array of `type => '.ext'`), read before the catalogue of `oihana\files\enums\FileMimeType` — for a type it does not know, or to prefer one of several (`[ 'audio/x-wav' => '.wav' ]`). Types are compared by their reference name (`oihana\files\normalizeMimeType()`) ; an extension must be a dot followed by letters and digits.
public
string
EXTENSIONS
= 'extensions'
FILENAME
The name of the stored file (single upload only). Default: a random name.
public
string
FILENAME
= 'filename'
The name is kept or refused, never altered : its directories are dropped, and it is refused when it starts with a dot, or when its extension does not match the type read from the content. A name already taken is refused, unless self::OVERWRITE is set.
MAX_SIZE
Maximum allowed file size in bytes. Larger uploads are rejected. Default: no limit.
public
string
MAX_SIZE
= 'maxSize'
OVERWRITE
Whether an existing target file may be overwritten. Default: false.
public
string
OVERWRITE
= 'overwrite'