[Vuejs]-Unable to read filelist object in Laravel controller from vue

0👍

There are a couple of issues with your code.


Firstly, V-on::change="onImageChange" should be:

v-on:change="onImageChange" 

Please note:

  • the lowercase v for v-on
  • the single :

Alternatively, you could write @change="onImageChange".


Secondly, event.target.files returns a FileList not a single file so you need to change your onImageChange code to the following be able to get the file itself:

onImageChange(event) {
    this.files.push(event.target.files[0]); //Note the [0] after files
},

Leave a comment