Reputation: 171
I can't put a v-model in input tag with type="file", are there any good options to fix that? This is how my HTML looks like:
<input v-model="imageReference" type="file" name="file"/>
Upvotes: 1
Views: 2238
Reputation: 4684
Using v-model makes no sense as you can't set a value on a file input - therefor there is no two way binding here
Just use v-on:change
<input id="image" v-on:change="onFileChange" type="file">
and define a method like
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
console.log(files);
},
Upvotes: 2