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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
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
Heroku's filesystem is not persistent. You need to store uploaded files somewhere offsite. Amazon S3 is a common choice.