I'm making an upload functionality in my webapp with vue 2. Currently it looks like this:
<label class="btn btn-xs btn-primary">
<input type="file" name="attachment[]" @change="onFileChange" multiple/>
Upload file
</label>
input[type="file"] {
display: none;
}
onFileChange() {
this.reaction.attachment = event.target.files || event.dataTransfer.files;
}
So now I would like to show the file names that are on the event.target.files object.
I've tried this:
<p v-for="file in reaction.attachment">
{{ file.name }}
</p>
But that's not working!? When I look into my vue devtools the attachment object looks like this:
attachment:FileList
So how do I get this to work?
Thanks a lot