vue-dropzone icon indicating copy to clipboard operation
vue-dropzone copied to clipboard

Prevent upload of files not in acceptedFiles list

Open mklahorst opened this issue 3 years ago • 3 comments

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 avatar May 06 '21 22:05 mklahorst

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!

mklahorst avatar May 06 '21 22:05 mklahorst

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

zahidhasanemon avatar Mar 23 '22 08:03 zahidhasanemon

@zahidhasanemon I did not find a solution.

mklahorst avatar Mar 23 '22 18:03 mklahorst