使用attachment_fu上传文件
现在我将文件存储在我的应用程序的公共目录中。
我想将文件上传到特定路径,例如 http://uploadfacility.com。
我有该特定路径的登录名和密码。
http://uploadfacility.com/test?username=test1&password=test1
我如何将文件存储到应用程序之外的特定路径。
我需要修改:存储或其他什么?
Right now i am storing files inside public directory in my application.
I want to upload file to specific path like http://uploadfacility.com.
I have a login and password for that specific path.
http://uploadfacility.com/test?username=test1&password=test1
How may i store files to specific path outside my application.
I need to modify :storage or anything else ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要创建一个新模块(在插件中称为“后端”),
Technoweenie::AttachmentFu::Backends.const_get('YourChosenBackend')
。恐怕这个后端的契约是在其他后端模块中隐式定义的。您可以参考
s3
、file_system
或db
。根据合同,我的意思是您需要重写/定义一些方法。一些示例(我从file_sysyem_backend.rb
中获取它们:定义后端后,您可以将选项
:storage => :your_chosen
传递给有_附件
。You need to create a new module (referred as 'backend' in the plugin),
Technoweenie::AttachmentFu::Backends.const_get('YourChosenBackend')
.The contract for this backend is, i am afraid, implicitly defined in other backend modules. You can refer to
s3
,file_system
ordb
. By contract I mean that there are some methods that you need to override / define. A few examples (i took them fromfile_sysyem_backend.rb
:Once you have defined your backend, you can then pass the option
:storage => :your_chosen
tohas_attachment
.