I am using the vue2-editor library.When I upload an image , I create a formdata and append the uploaded image to it . But when I send this form data to server it shows null!
The vue js code
handleImageAdded(file, editor, cursorLocation, resetUploader) {
let formdata = new FormData();
formdata.append("image", file);
axios.post('/upload/answer/image', {
formdata
})
.then(response => {
console.log(response.data);
});
}
The laravel code
Route::post('/upload/answer/image', function (Request $request) {
dd($request->all());
});
The above code shows null!
However the below code works
handleImageAdded(file, editor, cursorLocation, resetUploader) {
let formdata = new FormData();
formdata.append("image", file);
console.log(formdata.get("image");
}
This means that there is something fishy in laravel side.What should I do?
Note: I am following the exact same steps as shown here