The photo disappeared on Hereka

Yesterday I deployed my first Heroku app, and it worked just fine.

In my application you can upload an image, I did it and was able to see it on the "show" page. However, today the image has disappeared. Everything else is working fine. The application works fine on my local machine, as well as on Heroku, except for the image, which is not there.

What could be the problem? How can I make sure this does not happen again?

+4
source share
2 answers

Heroku does not support file downloads. The file system is read-only. You will need to post the downloaded files somewhere else (or from the database, which is a bad option).

https://devcenter.heroku.com/articles/read-only-filesystem

Amazon S3 is a common choice: http://devcenter.heroku.com/articles/s3

If you use any gems such as paperclip or carrierwave to download, using S3 will be easy. You will need to set the S3 credentials in the configuration file, and the gem will take care of the download and provide the URLs for the downloaded file.

+21
source

I suspect that you uploaded the image to the Heroku file system and not external storage such as Amazon S3. The Heroku file system is temporary and not shared between speakers or restarts that Heroku will do every day. I suspect this happened here, as a result of which you lost your image.

+6
source

All Articles