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

Prevent upload of files not in acceptedFiles list #604

Open
mklahorst opened this issue May 6, 2021 · 3 comments
Open

Prevent upload of files not in acceptedFiles list #604

mklahorst opened this issue May 6, 2021 · 3 comments

Comments

@mklahorst
Copy link

I am able to successfully use the acceptedFiles option setting to catch the error event when a wrong mimetype is uploaded, but I would like the users dialogue box to prevent uploading the wrong file type in the first place.

For example, if I only have application/jpeg as an acceptable mimetype, I want that to reflect in their native dialog box when they go to search for files.

How can this be accomplished? Thanks!

@mklahorst
Copy link
Author

UPDATE: So this is interesting.

If I have acceptedFiles set to application/jpeg, I am still able to select the non-JPG files in the dialog box, it throws an error (as expected) and I remove the file in the script.

However, on next attempt to upload a file (without a reload), the dialog box properly disables any non application/jpeg files! This is the expected behavior I want on first attempt.

Hopefully this provides some additional insight to a solution!

@zahidhasanemon
Copy link

facing the same issue when options are set dynamically. @mklahorst did you find any solution?

@mklahorst
Copy link
Author

@zahidhasanemon I did not find a solution.

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