FileSchemaclass
new FileSchema({ one = "file", title = "File", types, ...options }: FileSchemaOptions)| Param | Type | |
|---|---|---|
options | FileSchemaOptions | Allowed options for FileSchema. required |
.types | FileTypes | Set of allowed file extensions; when set, the file name's extension must be one of these. readonly |
| Return | |
|---|---|
FileSchema | Schema that validates a file name matching one or more extensions. |
| Property | Type | |
|---|---|---|
.types | FileTypes | Set of allowed file extensions; when set, the file name's extension must be one of these. readonly |
Schema that validates a file name matching one or more extensions.
- Requires the file name to have an extension.
- When
typesis set, the extension must be one of the allowedFileTypes.
Examples
FILE.validate("photo.jpg"); // Returns "photo.jpg"