Add a validation function for Dropzone before accepting files
#8430
shaadcode
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, there is no documented way to perform direct file validation before the
Dropzonecomponent accepts files.It would be very useful to have a built-in validation function that runs before files are dropped and determines whether they should be accepted or rejected.
Problem
While it’s technically possible to handle file validation manually (e.g., by filtering in
onDrop), this approach doesn’t integrate well with theDropzone.Rejectcomponent — since that component is handled internally, likely via theacceptprop.As a result, the current behavior makes it hard to show the appropriate visual feedback (using
Dropzone.AcceptandDropzone.Reject) for custom validation logic.Proposal
Introduce a
validate(orvalidator) function prop for<Dropzone>, for example:If validate returns false or throws an error, the
Dropzone.Rejectcomponent should be displayed automatically.Beta Was this translation helpful? Give feedback.
All reactions