回形针:如何上载Powerpoint演示文稿文件

克里希纳·维亚斯(Krishna Vyas)

如何使用Rails回形针处理器上载PowerPoint演示文稿文件和其他与办公室有关的文档。

这是我的代码。mime_types.rb中

Mime::Type.register "application/vnd.openxmlformats-officedocument.wordprocessingml.document", :docx
Mime::Type.register "application/vnd.openxmlformats-officedocument.presentationml.presentation", :pptx
Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx

在我的模型中asset.rb

has_attached_file :attachment, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :attachment, :content_type => ["application/pdf", "application/zip", "application/x-zip", "application/x-zip-compressed","application/octet-stream","image/jpg", "image/png", "image/jpeg", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]

我收到此错误资产附件内容类型无效资产附件无效

罗希特

在您的模型中

validates_attachment_content_type :attachment, :content_type => ["application/pdf", "application/zip", "application/x-zip", "application/x-zip-compressed","application/octet-stream","application/vnd.ms-office","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","image/jpg", "image/png", "image/jpeg"]

在您的mime_types.rb中

Mime::Type.register "application/pdf", :pdf
Mime::Type.register "application/xls", :xls
Rack::Mime::MIME_TYPES.merge!({
    ".xls"     => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",  
    ".xlsx"     => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    ".ppt"     => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    ".pptx"     => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    ".doc"     => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    ".docx"     => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
})

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

回形针:如何上载Powerpoint演示文稿文件

来自分类Dev

录制PowerPoint演示文稿时如何获得演示者视图?

来自分类Dev

如何在Ubuntu中查看带注释的Powerpoint演示文稿?

来自分类Dev

如何查看和编辑无法正确呈现的PowerPoint演示文稿?

来自分类Dev

如何在PowerPoint演示文稿中包含子点

来自分类Dev

如何从PowerPoint演示文稿中提取所有图像?

来自分类Dev

如何查看和编辑无法正确呈现的PowerPoint演示文稿?

来自分类Dev

如何在Ubuntu中查看带注释的Powerpoint演示文稿?

来自分类Dev

如何逐张合并 2 个 PowerPoint 演示文稿?

来自分类Dev

设置Powerpoint演示文稿的语言

来自分类Dev

Excel 更新 PowerPoint 演示文稿

来自分类Dev

打开PowerPoint演示文稿并隐藏窗口

来自分类Dev

获取PowerPoint演示文稿的当前缩放

来自分类Dev

从Word VBA编辑PowerPoint演示文稿页脚

来自分类Dev

删除Powerpoint演示文稿中的命名对象

来自分类Dev

循环播放Powerpoint演示文稿的选定部分

来自分类Dev

每个Powerpoint演示文稿文件(.ppt或.pptx)是否有任何唯一的ID?

来自分类Dev

如何在Powerpoint或Google幻灯片中显示幻灯片演示文稿的高级概述

来自分类Dev

在VBA powerpoint中如何将新幻灯片添加到空白演示文稿

来自分类Dev

如何使用Python从PowerPoint演示文稿幻灯片中提取评论

来自分类Dev

如何查看由Microsoft Producer for PowerPoint 2002生成的演示文稿

来自分类Dev

如何更改PowerPoint 2010演示文稿中所有图片的格式?

来自分类Dev

如何在Excel VBA中获取打开的PowerPoint演示文稿的处理程序

来自分类Dev

如何使用Apache的POI以编程方式从Powerpoint演示文稿中读取图形值?

来自分类Dev

如何在Powerpoint或Google幻灯片中显示幻灯片演示文稿的高级概述

来自分类Dev

如何将标题幻灯片插入PowerPoint演示文稿中?

来自分类Dev

如何修复PowerPoint 2016演示文稿中某些幻灯片的母版不匹配?

来自分类Dev

如何使用VBA将文本框添加到PowerPoint演示文稿

来自分类Dev

更新PowerPoint演示文稿中的链接时,如何更新链接图像的长宽比?

Related 相关文章

  1. 1

    回形针:如何上载Powerpoint演示文稿文件

  2. 2

    录制PowerPoint演示文稿时如何获得演示者视图?

  3. 3

    如何在Ubuntu中查看带注释的Powerpoint演示文稿?

  4. 4

    如何查看和编辑无法正确呈现的PowerPoint演示文稿?

  5. 5

    如何在PowerPoint演示文稿中包含子点

  6. 6

    如何从PowerPoint演示文稿中提取所有图像?

  7. 7

    如何查看和编辑无法正确呈现的PowerPoint演示文稿?

  8. 8

    如何在Ubuntu中查看带注释的Powerpoint演示文稿?

  9. 9

    如何逐张合并 2 个 PowerPoint 演示文稿?

  10. 10

    设置Powerpoint演示文稿的语言

  11. 11

    Excel 更新 PowerPoint 演示文稿

  12. 12

    打开PowerPoint演示文稿并隐藏窗口

  13. 13

    获取PowerPoint演示文稿的当前缩放

  14. 14

    从Word VBA编辑PowerPoint演示文稿页脚

  15. 15

    删除Powerpoint演示文稿中的命名对象

  16. 16

    循环播放Powerpoint演示文稿的选定部分

  17. 17

    每个Powerpoint演示文稿文件(.ppt或.pptx)是否有任何唯一的ID?

  18. 18

    如何在Powerpoint或Google幻灯片中显示幻灯片演示文稿的高级概述

  19. 19

    在VBA powerpoint中如何将新幻灯片添加到空白演示文稿

  20. 20

    如何使用Python从PowerPoint演示文稿幻灯片中提取评论

  21. 21

    如何查看由Microsoft Producer for PowerPoint 2002生成的演示文稿

  22. 22

    如何更改PowerPoint 2010演示文稿中所有图片的格式?

  23. 23

    如何在Excel VBA中获取打开的PowerPoint演示文稿的处理程序

  24. 24

    如何使用Apache的POI以编程方式从Powerpoint演示文稿中读取图形值?

  25. 25

    如何在Powerpoint或Google幻灯片中显示幻灯片演示文稿的高级概述

  26. 26

    如何将标题幻灯片插入PowerPoint演示文稿中?

  27. 27

    如何修复PowerPoint 2016演示文稿中某些幻灯片的母版不匹配?

  28. 28

    如何使用VBA将文本框添加到PowerPoint演示文稿

  29. 29

    更新PowerPoint演示文稿中的链接时,如何更新链接图像的长宽比?

热门标签

归档