We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the solution you'd like There should be a way to make sure users can't upload 2 of the same files.
Describe alternatives you've considered I've tried to do this outside of the dropzone, but there doesn't seem to a way.
Teachability, Documentation, Adoption, Migration Strategy It could just be a prop passed in called noDuplicates
My solution its not perfect, im looking for better solutions for this problem:
const { getRootProps, getInputProps } = useDropzone({ accept: 'image/*', onDrop: (acceptedFile) => { const newFiles = acceptedFile.map(file => { return Object.assign(file, { preview: URL.createObjectURL(file) }) }) setFieldValue('files', [ ...files, ...newFiles ]) files.map(file => { newFiles.forEach(newFile => { if (newFile.name == file.name) { setToast({ open: true, severity: 'error', text: 'Não é possível adicionar imagens duplicadas!' }) const filteredArray = files.filter((item, index) => files.indexOf(item) == index) setFieldValue('files', filteredArray) } }) }) } }) const handleRemoveFile = (fileName) => { const newFiles = files.filter(item => item.name !== fileName) setFieldValue('files', newFiles) }
The text was updated successfully, but these errors were encountered:
@Gkanawati Just curious, why do you not use the Custom validation?
Sorry, something went wrong.
There's what i was looking for!
No branches or pull requests
Describe the solution you'd like
There should be a way to make sure users can't upload 2 of the same files.
Describe alternatives you've considered
I've tried to do this outside of the dropzone, but there doesn't seem to a way.
Teachability, Documentation, Adoption, Migration Strategy
It could just be a prop passed in called noDuplicates
My solution its not perfect, im looking for better solutions for this problem:
The text was updated successfully, but these errors were encountered: