respect-validation/docs/rules/Mimetype.md

38 lines
748 B
Markdown
Raw Normal View History

2015-06-16 06:16:29 +02:00
# Mimetype
- `Mimetype(string $mimetype)`
2015-06-16 06:16:29 +02:00
Validates if the input is a file and if its MIME type matches the expected one.
2015-06-16 06:16:29 +02:00
```php
v::mimetype('image/png')->validate('image.png'); // true
v::mimetype('image/jpeg')->validate('image.jpg'); // true
2015-06-16 06:16:29 +02:00
```
This rule is case-sensitive and requires [fileinfo](http://php.net/fileinfo) PHP extension.
## Categorization
- File system
## Changelog
Version | Description
--------|-------------
1.0.0 | Created
***
See also:
2015-06-16 06:16:29 +02:00
- [Directory](Directory.md)
- [Executable](Executable.md)
- [Exists](Exists.md)
- [Extension](Extension.md)
- [File](File.md)
2018-12-11 13:31:50 +01:00
- [Image](Image.md)
- [Readable](Readable.md)
- [Size](Size.md)
- [SymbolicLink](SymbolicLink.md)
- [Uploaded](Uploaded.md)
- [Writable](Writable.md)