Home > Back-end >  How to upload Image to HerokuApp through multer without losing it?
How to upload Image to HerokuApp through multer without losing it?

Time:05-22

I build a MERN app and hosted on heroku.

I saved the user's images on server by multer and it works fine for some time i.e. uploaded image is fetched successfully. But after closing the application for long that image is not available on server.

On searching I found that each dyno on heroku boots with a clean copy of the filesystem from the most recent deploy.

But then how and where to save images?

CodePudding user response:

Dyno file system is ephemeral so you need to store the file on an external storage (ie S3, Dropbox) or use an Heroku plugin (ie for FTP).

Check Files on Heroku to understand (free) options for storing/managing files (the examples are in Python but the concept is valid for other stacks too).

  • Related