错误号:: ENOENT在亚马逊S3(没有这样的文件或目录) [英] Errno::ENOENT (No such file or directory) in amazon-s3

查看:226
本文介绍了错误号:: ENOENT在亚马逊S3(没有这样的文件或目录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这是使用Amazon S3的发布图像buckets.This工作完全正常部署到Heroku的应用程序。但是,当获取相同的图像提示错误:

 变量Errno :: ENOENT(没有这样的文件或目录显示路径s3.amazonaws.com/bucket_name/app/public/messages/images/000/000/061/thumb/images。 JPEG?1362410115)
 

相同的路径复制和粘贴在浏览器的URL不起作用。如果我使用的水桶名称终点它的工作原理即与下面的路径

<$p$p><$c$c>/bucket_name.s3.amazonaws.com/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115.

但我不知道如何配置的网址,我的模型。我下面Heroku的方式来配置AWS-SDK。

  https://devcenter.heroku.com/articles/paperclip-s3
 

型号has_attached_file好像我失去了一些东西here.For配置的其余部分,你可以检查上面的链接。

  has_​​attached_file:图像:风格=&GT; {:中等=&GT; 100×100&gt;中,:拇指=&​​GT; 100×100&gt;中}
 

感谢

解决方案

包括给予code在配置/初始化/ paper_clip.rb解决了我的问题。

 回形针:: Attachment.default_options.merge!(
        :URL =&GT; :s3_domain_url,
        :PATH =&GT; 应用程序/公/:类/:附件/:id_partition /:款式/:文件名
    )
 

I have application which is deployed to heroku using amazon s3 posting images to buckets.This works perfectly fine. But when fetch the same image it gives error:

Errno::ENOENT (No such file or directory showing path s3.amazonaws.com/bucket_name/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115)

Same path copying and pasting in browser's url doesn't work. If I am using bucket name as end point it works ie, with following path

/bucket_name.s3.amazonaws.com/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115.

But I dont know how to configure this url in my model. I am following heroku's way to configure aws-sdk.

 https://devcenter.heroku.com/articles/paperclip-s3

Model has_attached_file seems like i am missing something here.For rest of configuration you can check above link.

has_attached_file :image, :styles => { :medium => "100x100>", :thumb => "100x100>" }

Thanks

解决方案

Including given code in config/initializers/paper_clip.rb resolved my problem.

    Paperclip::Attachment.default_options.merge!(
        :url => ':s3_domain_url',
        :path => 'app/public/:class/:attachment/:id_partition/:style/:filename'
    )

这篇关于错误号:: ENOENT在亚马逊S3(没有这样的文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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