Skip to main content

File

Check if the input value is a file.

The validation rule requires a value to run.

Example

src/app/posts/controllers/create-post.ts
// ...
createPost.validation = {
rules: {
title: ["required"],
image: ["required", "file"],
},
};

It works also if the input is an array of files:

src/app/posts/controllers/create-post.ts
// ...
createPost.validation = {
rules: {
title: ["required"],
images: ["required", "file"],
},
};