[Vuejs]-Cannot download file Symfony 3.4 and VueJS

0👍

So it seems that the output of console.log(response.data) is showing a binary file. I mean the file is there. You are not clear when you say

but I always get something wrong

Try this

axios.post('/api', {
    url: this.url,
    responseType: 'blob',
}).then((response) => { 
    let blob = new Blob([response.data], {
        type: 'video/webm'
    });
    url = window.URL.createObjectURL(blob);

    window.open(url);
}).catch(error => {
    console.log(error);
});

In my opinion, the issue here is that you did not put a semi colon at the end of the line where you created the blob.

Leave a comment