So I am trying to allow the users to upload images to my server to show it on a website later. I am using Multer like this:
var uploadLogo = multer({
dest: './public/images/logos/'
});
.post(uploadLogo.single('logo'), (req, res, next) => {
var r = req.body;
account.register(
new account({
'employer': {
'logo': req.file,
}
},
r.password
))
});
The interesting thing is, this works on the local version, but images disappear after a while on the online version.
How can I check if the images exist on the server? Or should I maybe use a 3rd party API like imgur to handle this?
The free Heroku dynos are stopped after some time of inactivity, and all the locally stored data is removed. Consider persisting the images in something like AWS S3.