VuetifyImageInput icon indicating copy to clipboard operation
VuetifyImageInput copied to clipboard

Add "Accept" file input parameter to restrict input file formats

Open dgrabla opened this issue 4 years ago • 1 comments

It would be great if we could restrict the format of the selectable files. At the moment when we click on the component, a native file picker is opened where the user can select any file. If a non-image is selected, the component fails silently. If the file is an image, the canvas is populated and the image converted to the format selected on the imageFormat prop.

It would be great to be able to open a "restricted" file picker with a list of possible format. v-file-input has the accept property, but here it seems we use a different vue-file-upload component.

We would need to create a new prop "accept" on the vuetifyImageInput and then use it on the input form appended onClick on /src/VueFileUpload/methods/onClick.js . Would that work?

On https://github.com/SeregPie/VuetifyImageInput/blob/master/src/VueFileUpload/methods/onClick.js

input.setAttribute('type', 'file');
input.setAttribute('accept', '.png');

dgrabla avatar Apr 08 '20 13:04 dgrabla

Looking for the same feature. Couldn't find a way to add input.setAttribute('accept', 'image/*'); Since the input is only created after choosing the image :/

Daniel4Digital avatar Jul 22 '21 15:07 Daniel4Digital