Validate files based on their name.
The FileNameValidator extension can be configured with the FileNameValidatorOptions object.
import { defineFilePond } from 'filepond';
import { locale } from 'filepond/locales/en-gb.js';
import { FileNameValidator } from 'filepond/extensions/file-name-validator.js';
defineFilePond({
locale,
extensions: [
// Add the FileNameValidator extension and configure with FileNameValidatorOptions object
[FileNameValidator, {
// Prevent adding files with names longer than 10 characters
test: (name) => {
return name.length > 10;
}
}]
]
})