Heroku doesn't save uploaded images?

半城伤御伤魂 提交于 2019-12-23 16:52:35

问题


I have a Rails 4 app running on Heroku.

I'm using carrierwave and rmagick to upload pictures in to the app itself.

The app runs ok and it uploads the pictures and i can use them for about 24 hours, but if I log on the second day the links to the images are broken and it says that it can not find the pictures.

The account on Heroku is the basic free account.


回答1:


Heroku runs an ephemeral file system - whilst you can write files to it files are lost when dyno's are rebooted (every 24 hours) or when you deploy/restart you application. You need implement carrierwave + s3 to persist your uploaded files.

Take a read of https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem



来源:https://stackoverflow.com/questions/24671358/heroku-doesnt-save-uploaded-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!