filepond-plugin-file-validate-size
filepond-plugin-file-validate-size copied to clipboard
Add min/max file size limits by mime type.
Closes issue #3.
Adds optional mimeMinFileSizes and mimeMaxFileSizes config options, these should work in conjunction with existing min/max and max total limits, and allow for setting min or max limits by explicit mime type or mime type wildcard group:
ie:
<script>
// Register the plugin with FilePond
FilePond.registerPlugin(FilePondPluginFileValidateSize);
// Get a reference to the file input element
const inputElement = document.querySelector('input[type="file"]');
// Create the FilePond instance
const pond = FilePond.create(inputElement, {
mimeMaxFileSizes: {
'image/*': '3MB',
'image/gif': '5MB',
'video/mp4': '100MB'
}
});
</script>
That config will allow images of any type up to 3mb, but allow gifs to be up to 5mb, and restrict mp4 videos to 100MB.
Appreciate the PR, will consider for v5