Validate files based on their min and/or max size.
import { defineFilePond } from 'filepond';
import { locale } from 'filepond/locales/en-gb.js';
import { FileSizeValidator } from 'filepond/extensions/file-size-validator.js';
defineFilePond({
locale,
extensions: [
// Add the FileSizeValidator extension
[FileSizeValidator, {
maxSize: '10MB'
}]
]
})
Configuration
The FileSizeValidator extension accepts an option object of type FileSizeValidatorOptions which defines the properties below.
minSize
Min file size in bytes or a natural file size. Defaults to 0
minSize?: string | number
maxSize
Max file size in bytes or a natural file size. Defaults to Infinity
maxSize?: string | number