Search code examples
node.jsblobjpeg

Blob element to .jpg with multer


There are lots of info about this and I looked for the solution a few hours and didnt manage to make anything work. I hope you can help me.

I convert the canvas to a blob element: blob:null/80883af2-ce7a-49f0-adfa-f8ea2f63c9fc. I send this to the server with an ajax call:

var data = new FormData();
data.append('fname', 'test.jpg');
data.append('data', url);
$.ajax({
    type: 'post',
    url: 'http://localhost:3000/post',
    data: data,
    processData: false,
    contentType: false
})

I dont manage to save it as a .jpg. I tried many things and didnt succeed in anything...


Solution

  • I figured it out how to use multer in the end and still used the base64- the 'base64Img' package.