rowanwins / vue-dropzone

A Vue.js component for Dropzone.js - a drag’n’drop file uploads utility with image previews
https://rowanwins.github.io/vue-dropzone/docs/dist
MIT License
2.02k stars 1.4k forks source link

Prevent upload of files not in acceptedFiles list #604

Open mklahorst opened 3 years ago

mklahorst commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

mklahorst commented 2 years ago

@zahidhasanemon I did not find a solution.