Deploying using Heroku

2019-09-06 08:38发布

I am trying to deploy a Laravel application on Heroku. The problem is that every time I push changes to heroku, the old uploaded assets are lost. I am storing the images uploaded to a directory uploaded which are lost everything I push changes. Is there a way to prevent it?

2条回答
孤傲高冷的网名
2楼-- · 2019-09-06 08:56

Heroku doesn't have a persistent file system. Your files disappear because each deploy restarts your dynos, effectively destroying all the previously uploaded files. You must use cloud storage on Heroku for anything you wish to be permanent, like avatars, uploaded documents, etc. Check out their Add-ons for examples.

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

查看更多
仙女界的扛把子
3楼-- · 2019-09-06 09:15

Heroku's filesystem is not persistent. You need to store uploaded files somewhere offsite. Amazon S3 is a common choice.

查看更多
登录 后发表回答