I'm trying to upload pdf file in Vue.js and laravel, files_array is defined like this:
data(){
return {
formData: new Form ({
files_array:'',
first_name:'',
last_name :'',
...
This is a file select function:
selectFile(e) {
let pdfFile = e.target.files[0];
this.formData.files_array= pdfFile;
}
Upload Function :
const header = {
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer ' + this.Data.api_token,
};
onUpload(){
axios.post(`/upload`, this.formData , {headers: header}).then((response) =>{
});
}
When i try to upload a file then i'm getting
Warning: Missing boundary in multipart/form-data POST in vue.js
I tried following link to
php message Warning: Missing boundary in multipart/form-data POST data in Unknown on line 0
but then i'm not getting any data in controller
Any help is highly appreciated.