프로퍼티 |
타입 |
설명 |
|
$checkExtensionByMimeType |
|
whether to check file type (extension) with mime-type. If extension produced by
file mime-type check differs from uploaded file extension, the file will be considered as invalid. |
|
$extensions |
|
a list of file name extensions that are allowed to be uploaded.
This can be either an array or a string consisting of file extension names
separated by space or comma (e.g. "gif, jpg").
Extension names are case-insensitive. Defaults to null, meaning all file name
extensions are allowed. |
|
$maxFiles |
|
the maximum file count the given attribute can hold.
Defaults to 1, meaning single file upload. By defining a higher number,
multiple uploads become possible. Setting it to 0 means there is no limit on
the number of files that can be uploaded simultaneously.
> Note: The maximum number of files allowed to be uploaded simultaneously is
also limited with PHP directive max_file_uploads, which defaults to 20. |
|
$maxSize |
|
the maximum number of bytes required for the uploaded file.
Defaults to null, meaning no limit.
Note, the size limit is also affected by upload_max_filesize and post_max_size INI setting
and the 'MAX_FILE_SIZE' hidden field value. See FileValidator::getSizeLimit for details. |
|
$message |
|
the error message used when a file is not uploaded correctly. |
|
$mimeTypes |
|
a list of file MIME types that are allowed to be uploaded.
This can be either an array or a string consisting of file MIME types
separated by space or comma (e.g. "text/plain, image/png").
The mask with the special character * can be used to match groups of mime types.
For example image/* will pass all mime types, that begin with image/ (e.g. image/jpeg, image/png).
Mime type names are case-insensitive. Defaults to null, meaning all MIME types are allowed. |
|
$minSize |
|
the minimum number of bytes required for the uploaded file.
Defaults to null, meaning no limit. |
|
$tooBig |
|
the error message used when the uploaded file is too large.
You may use the following tokens in the message:
- {attribute}: the attribute name
- {file}: the uploaded file name
- {limit}: the maximum size allowed (see FileValidator::getSizeLimit)
- {formattedLimit}: the maximum size formatted
with [[\yii\i18n\Formatter::asShortSize()|Formatter::asShortSize()]] |
|
$tooMany |
|
the error message used if the count of multiple uploads exceeds limit.
You may use the following tokens in the message:
- {attribute}: the attribute name
- {limit}: the value of [[maxFiles]] |
|
$tooSmall |
|
the error message used when the uploaded file is too small.
You may use the following tokens in the message:
- {attribute}: the attribute name
- {file}: the uploaded file name
- {limit}: the value of [[minSize]]
- {formattedLimit}: the value of [[minSize]] formatted
with [[\yii\i18n\Formatter::asShortSize()|Formatter::asShortSize()] |
|
$uploadRequired |
|
the error message used when no file is uploaded.
Note that this is the text of the validation error message. To make uploading files required,
you have to set [[skipOnEmpty]] to false. |
|
$wrongExtension |
|
the error message used when the uploaded file has an extension name
that is not listed in [[extensions]]. You may use the following tokens in the message:
- {attribute}: the attribute name
- {file}: the uploaded file name
- {extensions}: the list of the allowed extensions. |
|
$wrongMimeType |
|
the error message used when the file has an mime type
that is not allowed by [[mimeTypes]] property.
You may use the following tokens in the message:
- {attribute}: the attribute name
- {file}: the uploaded file name
- {mimeTypes}: the value of [[mimeTypes]] |
|