FileRules::changeName()
Validates if the filename can be changed
FileRules::changeName(Kirby\Cms\File $file, string $name, string|null $extension = null): void
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| $filerequired | Kirby\Cms\File |
no default value | |
| $namerequired | string |
no default value | |
| $extension | stringornull |
null
|
If not passed, the current extension is kept |
Exceptions
| Type | Description |
|---|---|
Kirby\Exception\DuplicateException |
If a file with this name exists |
Kirby\Exception\InvalidArgumentException |
If the new extension or filename is forbidden |
Kirby\Exception\PermissionException |
If the user is not allowed to rename the file |