NodeJS write base64 encoded image to file
Got same bug, it's because of incorrect url
path, You may added app.use("/", express.static(path.join(__dirname, 'public')));
, so no need to add the public
in the url, check your url path once.
working sample :
url = req.protocol+'://'+req.headers.host+"/"+filename;
url = req.protocol+'://'+req.headers.host+"/images/"+filename;
// its inpublic/images
Try using ./public/aboutToGiveUp.png or make sure that the path is relative to the file containing this code.