IFilenameValidator
in
Tags
Table of Contents
Methods
- isFilenameValid() : bool
- It is recommended to use `\OCP\Files\Storage\IStorage::isFileValid` instead as this only checks if the filename is valid in general but not for a specific storage which might have additional naming rules.
- sanitizeFilename() : string
- Sanitize a give filename to comply with admin setup naming constrains.
- validateFilename() : void
- It is recommended to use `\OCP\Files\Storage\IStorage::isFileValid` instead as this only checks if the filename is valid in general but not for a specific storage which might have additional naming rules.
Methods
isFilenameValid()
It is recommended to use `\OCP\Files\Storage\IStorage::isFileValid` instead as this only checks if the filename is valid in general but not for a specific storage which might have additional naming rules.
public
isFilenameValid(string $filename) : bool
Parameters
- $filename : string
-
The filename to check for validity
Tags
Return values
boolsanitizeFilename()
Sanitize a give filename to comply with admin setup naming constrains.
public
sanitizeFilename(string $name[, null|string $charReplacement = null ]) : string
If no sanitizing is needed the same name is returned.
Parameters
- $name : string
-
The filename to sanitize
- $charReplacement : null|string = null
-
Character to use for replacing forbidden ones - by default space, dash or underscore is used if allowed.
Tags
Return values
stringvalidateFilename()
It is recommended to use `\OCP\Files\Storage\IStorage::isFileValid` instead as this only checks if the filename is valid in general but not for a specific storage which might have additional naming rules.
public
validateFilename(string $filename) : void
This will validate a filename and throw an exception with details on error.
Parameters
- $filename : string
-
The filename to check for validity