What’s the Best Way to Store Images for My App on Heroku?

0
13
Asked By CreativePenguin42 On

Hey everyone! I previously built a social media app on Heroku where users could post images. However, I noticed that my images would disappear every time the app reset, which happened daily. I understand that storing only the image paths in the database is standard practice, but I was still using Heroku to store the images, which is problematic since they get deleted during resets. On my local machine, saving images in the project directory works perfectly, but Heroku seems to wipe those files clean. What are the best practices for storing images to avoid losing them, especially while using Heroku?

2 Answers

Answered By ImageInnovator23 On

You might want to try using Cloudinary. They have a great free tier with lots of features. Plus, they offer an uploader widget that makes it easy for users to upload images directly through a browser, which can enhance the user experience.

Answered By TechyTurtle57 On

You should consider hosting your images externally, either on AWS S3 or something similar like MinIO. If you're using Docker, you could mount a persistent volume, but make sure all your servers can access it. On Heroku, check what services they offer for persistent storage since that's crucial for keeping your media intact.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.