Vue2.js + axios, can't append file to form data
axios.post( '/addTrack', this.form.data )
form data object:
form: {
data: {
title : '',
style : '',
authors: [
{
id: '',
rightholder: 1,
percent: ''
}
],
composers: [
{
id: '',
rightholder: 1,
percent: ''
}
],
right_area: 1,
},
errors: {
}
},
How to add a file to this request? This doesn't work:
this.form.data.file = e.target.files[0];
console.log shows that form.data.file property is correct File object, but axios send this:
file:{_choosed: true}
Content-Type:application/json