【发布时间】:2017-08-17 16:00:16
【问题描述】:
我正在使用 rails 发送一个 ms-word 文件。 即当我单击链接时,将发送来自 tmp 文件夹(在项目中)的 doc 文件。
我使用的代码是
@filename ="#{RAILS_ROOT}/tmp/test/test.doc"
send_file(@filename ,
:filename => "test",
:type => 'application/msword',
:disposition => 'attachment',
:streaming => 'true',
:buffer_size => '4096')
它正在工作,但它正在发送一个空文件。文件中缺少内容。有什么建议吗?
【问题讨论】:
-
+1。确保您没有发送空文件。
标签: ruby-on-rails