Mimetype

  • Mimetype(string $mimetype)

Validates if the input is a file and if its MIME type matches the expected one.

v::mimetype('image/png')->validate('image.png'); // true
v::mimetype('image/jpeg')->validate('image.jpg'); // true

This rule is case-sensitive and requires fileinfo PHP extension.

Categorization

  • File system

Changelog

Version Description
1.0.0 Created

See also: