Accepts
Validation that checks that a file's type is one of the acceptedFileTypes.
Each provided file type to accept must match one of the following:
A MIME type, indicating that files of the specified type are accepted (provided MIME types may contain wildcards such as
image/∗).A string whose first character is a full stop (
.), indicating that files with the specified file extension are accepted.
When the type of the file being validated does not match one of the acceptedFileTypes, then an issue is emitted with the provided code (defaults to DEFAULT_CODE). This issue contains a fileName data property with the name of the file that was validated, a mimeType data property with the MIME type of the file that was validated, and an accepted data property with the acceptedFileTypes.
Example usage:
Accepts("image/∗", ".pdf")Constructors
Properties
Accepted file types (each accepted file type must be either a MIME type or a file extension starting with a full stop).
Dependencies of the validation. Mapping of keys to the paths this validation depends on. Keys can be used within a ValidationContext to access the value of the dependencies.
Whether the form manager should reevaluate this validation whenever a descendant of the value being validated changes. This is false by default.
Set of external context dependencies of the validation.
Severity of the issue emitted when the file's type does not match one of the accepted file types.
Functions
Runs the validation within a ValidationContext containing the value being validated and the value of all declared dependencies. Returns a flow over all found issues.