如何使用attachment_fu插件在heroku服务器上上传图片 [英] How to upload images on heroku server using attachment_fu plugin

查看:164
本文介绍了如何使用attachment_fu插件在heroku服务器上上传图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku有一个应用程序,我需要简单的文件存储上传图像为这个I
使用send_data使用attachment_fu插件。
之后我用tmp /目录写这个文件并想在浏览器上显示,但是这些文件在浏览器中不显示。
如何在浏览器上显示这些图像?



什么是存储和检索图像的替代解决方案?

谢谢!

解决方案

您无法在Heroku上存储上传的文件。 b

您必须使用替代策略。一些替代策略:


  1. 将上传的文件存储在Heroku的数据库中。由于数据库系统并未专门针对存储文件进行优化,因此您应该在使用此策略之前测试应用程序的负载情况。

  2. 将$ b 存储上传的文件一个外部存储服务。 Amazon S3是一款非常受欢迎的云存储服务,任何人都可以使用,并且与Heroku一样具有按需付费的价格。 (事实上​​,Heroku本身运行在另一个亚马逊的云服务EC2之上。)


I have an app in Heroku, I need simple file storage for uploaded images for this I used send_data using attachment_fu plugin. After that I have used the tmp/ directory to write this file and want to display on browser, But these files are not displayed in browser. How can I display these images on browser?

What is the alternate solution to store and retrieve images?

Thanks!

解决方案

You cannot store uploaded files on Heroku.

You must use an alternative strategy. A couple alternative strategies:

  1. Store uploaded files in your database on Heroku. Because database systems are not specifically optimized for storing files, you should test out how well your application performs under load before you use this strategy.

  2. Store uploaded files in an external storage service. Amazon S3 is a popular cloud storage service that anyone can use, and it has pay-as-you-go pricing just like Heroku. (In fact, Heroku itself runs on top of another of Amazon's cloud services, EC2.)

这篇关于如何使用attachment_fu插件在heroku服务器上上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆