Commit c37ee95b by Evgeniy Tkachenko Committed by Alexander Makarov

Fixes #4286: Update input-file-upload.md

parent 773d67e5
......@@ -145,17 +145,24 @@ public function rules()
```
The thing is that it validates only file extension and not the file content. In order to validate content as well use
`mimeTypes` property of `ImageValidator`:
`mimeTypes` property of `FileValidator`:
```php
public function rules()
{
return [
[['file'], 'image', 'mimeTypes' => 'image/jpeg, image/png',],
[['file'], 'file', 'extensions' => 'jpg, png', 'mimeTypes' => 'image/jpeg, image/png',],
];
}
```
[List of common media types](http://en.wikipedia.org/wiki/Internet_media_type#List_of_common_media_types)
### Validating uploaded image
If you upload an image, [[yii\validators\ImageValidator|ImageValidator]] may come in handy. It verifies if an attribute
received a valid image that can be then either saved or processed using [Imagine Extension](https://github.com/yiisoft/yii2/tree/master/extensions/imagine).
### Uploading multiple files
If you need download multiple files at once some adjustments are required. View:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment