I am using multer to upload upload and saves images in client/images/post folder.
Here is a code snippet:
const storage = multer.diskStorage({
destination: './client/images/post',
filename: function(req, file, cb){
cb(null,file.fieldname + '-' + Date.now() + path.extname(file.originalname));
}
});
This works perfect in development. However, when I deploy this node app to heroku, images that are newly uploaded during production can't be found by Heroku.
I get this error:
https://mywebsite/images/post/photo-1673474603560.png 404 (Not Found)
However, if I look at source of other image tags that already existed when deployed - they are able to get into the folder and load their images.
Any ideas?