开发者

serving a file from temp with rails on read only file system

I'm deploying my apps now to a server that has a r开发者_JS百科ead only file system. I was using a gem to make a zip file and randomly plopping it in /public somewhere. Now I can only write to tmp - how do I serve the user that file out of the tmp folder?


I ended up not using any of these methods. I am on Heroku, and the amount of images/files I need to serve isn't large enough to warrant cloud storage.

What I did was create a file in tmp using one method and linking to it with link_to_remote to generate the file. Another link was made to an action which uses send_file with the path of the file I created in temp.

The problems I was having was due to doing the generation and file serving being IN THE SAME method, which I will try to figure out and possibly post another question on.


You really don't want to do that - it's a huge security risk.


One possibility would be to store it as a BLOB in your database.


Why would you use a read-only (I'm assuming Heroku?) when you have to serve files? Seems like you're swimming upstream. I'd use an AWS instance. You get the reliability, access and bandwidth. Not free, but what is?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜