【发布时间】:2012-02-06 13:57:07
【问题描述】:
我有一个 Rails 应用程序,它创建了几个 csv 文件,将它们压缩并使用此行将它们作为附件(供下载)发送给客户端:
send_file t.path, :x_sendfile => true, :type => 'application/zip', :filename => "invited_friends_stats.zip"
当我查看在服务器上创建的压缩文件时,我可以使用它,但是,当我通过应用程序下载文件时,它会解压缩成 .zip.cpgz 文件,而反过来又压缩成 @987654323 @文件压缩成.zip.cpgz文件等。
然后我下载了“The Unarchiver”应用程序(在 Mac OSX 上),当我尝试打开 .zip 文件时出现错误:"the contents cannot be extracted with this program"
有人知道为什么会这样吗?编码错误等?上面一行或我的配置中是否缺少可以解决此问题的内容?
【问题讨论】:
标签: ruby-on-rails ruby archiving