javascript - How to send a base64 image to node js server -
i know how retrieve base64 image canvas using javascript on html page:
var url = canvas.todataurl("image/png"); url.replace(/^data:image\/(png|jpg);base64,/, "");
now want send information server , create image. want like:
router.post('/createimage', function (req, res) { var base64image = //i need base64 image here var picpath = path.normalize('./public/images/users/pic.png'); fs.writefile(picpath, url, 'base64', function(err) { console.log(err); }); });
how can that?