无法将文件上传到Cloudinary [英] Cannot upload files to Cloudinary

查看:86
本文介绍了无法将文件上传到Cloudinary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cloudinary不允许我上传XLS文件,前提是它支持XLS文件。我正在使用Heroku加载项。

Cloudinary won't let me upload XLS files when it says they support it. I'm using the Heroku add-on.

C:\Users\Chloe\workspace\fortuneempire>rails console
Loading development environment (Rails 5.0.2)
irb(main):001:0> Cloudinary::Uploader.upload('C:\Users\Chloe\Documents\Chocolate_Store1.xls')
CloudinaryException: Invalid image file
        from C:/ruby23/lib/ruby/gems/2.3.0/gems/cloudinary-1.8.0/lib/cloudinary/uploader.rb:336:in `block in call_api'

http://cloudinary.com/faq


我可以在Cloudinary上托管任何类型的内容吗?
是。 Cloudinary提供了完整的图像管理解决方案,但将管理您丢给它的任何文件类型,包括视频,文本文件等。 Cloudinary将按原样提供此类非映像文件。请注意,您不能使用Cloudinary来管理非法或高度争议的内容。如果不确定文件是否属于此类别,则可能需要阅读我们的服务条款和CDN合作伙伴的可接受使用政策。

Can I host any type of content on Cloudinary? Yes. Cloudinary offers a complete image-management solution, but will manage any file type you throw at it, including videos, textual files and more. Cloudinary will serve such non-image files as-is. Do notice that you can not use Cloudinary to manage illegal or highly controversial content. If you're uncertain whether your files fall into this category, you may want to read our TOS and our CDN partner's Acceptable Use Policy.

https://devcenter.heroku.com/articles/cloudinary

推荐答案

我必须添加:cloudinary_resource_type => :raw

  if Rails.env == 'production'
    has_attached_file :file, :storage => :cloudinary, :path => ':class/:id/:filename', 
      :cloudinary_resource_type => :raw

http://cloudinary.com/blog/using_cloudinary_to_manage_all_your_website_s_assets_in_the_cloud

https://github.com/GoGoCarl/paperclip-cloudinary#resource-types

这篇关于无法将文件上传到Cloudinary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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