在 Heroku 上的 Play 框架中处理文件上传
我意识到Heroku 有一个只读文件系统,并且研究了有关 attachment_fu
和其他类似的 Ruby gem 的问题,用于以暂时的方式处理文件上传,这样它们就不会真正到达磁盘(除了temp)直到它们被写入 Amazon S3。但是,我想在我即将进行的项目中使用 Play Framework (Java),并且需要支持将图片上传到图库。
显然,我需要使用像 S3 或数据库 blob 字段这样的可写后备存储:只要它适用于低容量网站(每月数百个请求),我就不会选择其中任何一个。有人用 Heroku 上的 Play 做过这个吗?我是 Play Framework 的新手,也是 Heroku 的新手,所以即使是非常明显的答案也会有所帮助!
Possible Duplicate:
Store Blob in Heroku (or similar cloud services)
I realize that Heroku has a read-only file system, and have looked at SO questions about attachment_fu
and other similar Ruby gems for handling file uploads in a transitory way so that they never really hit disk (other than temp) until they get written to Amazon S3. However, I'd like to use the Play Framework (Java) for my upcoming project, and need to support uploading pictures to a gallery.
Obviously I'll need to use a writable backing store like S3 or a database blob field: I'm not married to either one as long as it works for a low volume web site (several hundred requests per month). Has anyone done this with Play on Heroku? I'm new to Play Framework, and new to Heroku, so even really obvious answers would help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 github 上提供了如何使用 Amazon S3 执行此操作的示例:
https://github.com/jamesward/plays3upload
基本上你只需要将文件发送到S3并保存实体中的键:
I put an example of how to do this with Amazon S3 on github:
https://github.com/jamesward/plays3upload
Basically you just need to send the file to S3 and save the key in the entity: