Context
I have a page with questions, this has an structure like the following
sections:[{
    section: 1,
    questions:[{
        question: 1,
        attachment: [FormData Object]
        ...
    },
    {
        question: 2,
        attachment: [FormData Object]
        ...
    }]
}, ...]
Each question have an attachment. What I did was to create a FormData object, upload the file into it and add it to the question object. Example:
let formData = new FormData();
formData.append('file', event.target.files[0])
question.attachment = formData
Everything's fine so far. The problem comes when I try to send it to the server. I doesn't pass the form object to it. This is the code I use to send it:
this.$http.post('my-path', {data: this.sections}, {headers: {'Content-Type': 'multipart/form-data'}, emulateJSON: true})
Using emulateJSON: true sends the data but attachment attribute is not contained in the request.
Using headers: {'Content-Type': 'multipart/form-data'} for some reason send a null request.
Is there a way to do something like that and actually works?
 
     
     
    