Level 8
Try form.append('name', file, 'filename');
Hi, I've been stuck on this for longer than I'd link to admit and would really appreciate any help.
I'm making a POST request through vue-resource and it works fine until I want to send a file along with the title. When I attach the file and dd($request->all()) in the controller, an empty array is shown, even though when I send just the title it shows up fine.
Here is the code in the method that is creating the FormData object and submitting it:
let form = new FormData();
form.append('video', document.getElementById('video').files[0]);
form.append('title', this.title);
this.$http.post('/upload', form).then(response => console.log(response.data));
I've done a console.log(form) and it shows that the FormData object does include both the file and the title.
Any help would be really great
Please or to participate in this conversation.