Javascript 如何将base64映像发送到node js服务器
我知道如何使用HTML页面上的javascript从画布检索base64图像:Javascript 如何将base64映像发送到node js服务器,javascript,node.js,image,base64,Javascript,Node.js,Image,Base64,我知道如何使用HTML页面上的javascript从画布检索base64图像: var url = canvas.toDataURL("image/png"); url.replace(/^data:image\/(png|jpg);base64,/, ""); 现在我想将此信息发送到服务器并创建映像。 我想做一些类似的事情: router.post('/createImage', function (req, res) { var base64image = //i ne
var url = canvas.toDataURL("image/png");
url.replace(/^data:image\/(png|jpg);base64,/, "");
现在我想将此信息发送到服务器并创建映像。
我想做一些类似的事情:
router.post('/createImage', function (req, res) {
var base64image = //i need to get the base64 image here
var picPath = path.normalize('./public/images/users/pic.png');
fs.writeFile(picPath, url, 'base64', function(err) {
console.log(err);
});
});
我该怎么做