问题
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