Skip to content

Kirby 3.7.5

FileRules::validFile()

Validates the extension, MIME type and filename

FileRules::validFile(Kirby\Cms\File $file, string|null|false $mime = null): bool

Parameters

Name Type Default Description
$file * Kirby\Cms\File
$mime string|null|false null If not passed, the MIME type is detected from the file,
if false, the MIME type is not validated for performance reasons

Return type

bool

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException If the extension, MIME type or filename is missing or forbidden

Parent class

Kirby\Cms\FileRules