部署到 Heroku 时如何拥有持久文件存储?

How do I have a persistent file storage when deploying to Heroku?

我知道每次部署时 Heroku 的 dyno 都会刷新,所以无论如何我可以让我的文件持久化或者除了使用像 amazon S3 这样的服务没有其他方法吗?我使用回形针处理文件上传,大部分文件都是 pdf 格式。

最好使用 S3 或其他服务。

Ephemeral filesystem

Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.

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