问题标签 [docsplit]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
17 浏览

ruby-on-rails - 看到“Getting Errno::ENOENT ' no such file or directory @ rb_sysopen'”时如何在 Rails 中获取正确的 Tempfile 文件路径

我想在我的网站上显示演示文件的预览。我正在尝试制作一个临时文件,该文件从.pptx存储在活动存储中的 Microsoft PowerPoint Open XML ( ) 文件中读取。

我正在使用Docsplit.extract_images临时文件将幻灯片转换为图像,以某种形式的图像轮播将其显示为预览。

我有幻灯片参数,例如[:name, :ppt, pages: [] ]where pptishas_one_attached和 pages is has_many_attached。这是我的 slides_controller 的样子:

我收到一个Errno::ENOENT no such file or directory @ rb_sysopen错误。

这是获取tempfile路径的正确方法吗?

此外,如果我使用tempfile.path而不是"#{tempfile.path}",我会得到一个 nil 到字符串错误。