In the onchange
event you should pass the event object to a function and handle:
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length)
return;
this.createImage(files[0]);
},
For more information refer https://codepen.io/Atinux/pen/qOvawK/