I have been trying to upload a file with form data using axios in vue js with laravel backend. There are few solutions out there but I am not being able to make them work.
So here what I am trying to do. Here is my data in vue js and I am binding them with v-model.My form submission method and it's code
let formData = new FormData();
var file = document.querySelector('#report');
formData.append("file", file.files[0]);
formData.append('someName','someValue');
axios({
method: 'put',
url: self.sl+'/seller/upflv',
data: formData,
})
In laravel backend I am loggin using
\Log::info($request->all());
And I get an empty array in my log file.
Here is what I can see in my chrome network
------WebKitFormBoundary0Q7B39baNw6AJXDA
Content-Disposition: form-data; name="file"; filename="d.PNG"
Content-Type: image/png
------WebKitFormBoundary0Q7B39baNw6AJXDA
someValue
------WebKitFormBoundary0Q7B39baNw6AJXDA--
Any help or explanation would be extremely helpful. Thank you.
Ran into a problem like that some time ago.
check this https://github.com/laravel/framework/issues/13457#issuecomment-239451567
Try to send it like this: