[Vuejs]-How to use dom-to-image is a library to send image in server vuejs?

0👍

You should create a blob out of the image and then set the FormData:

saveImage(){
    let data = new FormData();
    domtoimage.toBlob(document.getElementById('my-node'))
      .then(function (blob) {
         data.append('data', blob);

          axios.post(`<Someurl>`, data, {
                headers: {
                    'Content-Type': 'multipart/form-data',
                },
           })
           .then(res => {
                console.log(res)
           })
     })
}

Leave a comment