Heroku不保存上传的图像? [英] Heroku doesn't save uploaded images?

查看:172
本文介绍了Heroku不保存上传的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku上运行了一个Rails 4应用程序。

我使用carrierwave和rmagick将图片上传到应用程序本身。

该应用程序运行正常,它可以上传图片,我可以使用它们大约24小时,但是如果我在第二天登录,图像的链接被破坏,它说它无法找到图片。

Heroku上的帐户是基本的免费帐户。 Heroku运行一个短暂的文件系统 - 虽然你可以写文件,但是当dyno重启时文件丢失了(每24小时)或者当您部署/重新启动应用程序时。您需要执行carrierwave + s3来保存您上传的文件。



阅读 https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem


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.

解决方案

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

这篇关于Heroku不保存上传的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆