Skip to content
New issue

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

Does material-ui-dropzone support custom error messages #349

Open
Tulean opened this issue Feb 27, 2022 · 1 comment
Open

Does material-ui-dropzone support custom error messages #349

Tulean opened this issue Feb 27, 2022 · 1 comment

Comments

@Tulean
Copy link

Tulean commented Feb 27, 2022

Bug Report

Describe the bug

Does material-ui-dropzone support custom error messages?

Steps to reproduce

I need to validate whether a file/files were uploaded. Does this package support error handling in terms of some props that we could input to?

@Maqil
Copy link

Maqil commented Mar 18, 2022

@Tulean You can use these 4 methods to handle each case
you can use it like this:

  <DropzoneArea
     acceptedFiles={acceptedFileFormat}
     onChange={handleFileChange}
     onDrop={handleFileDrop}
     filesLimit={1}
     maxFileSize={6000000}
     showFileNames
     getFileAddedMessage={(fileName) => `${fileName} ADDED!`}
     getDropRejectMessage={(rejectedFile) => `${rejectedFile} REJECTED!`}
     getFileRemovedMessage={(fileName) => `${fileName} REMOVED!`}
     getFileLimitExceedMessage={(filesLimit) => `:filesLimit ${filesLimit}`}
   />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants