I use Linode as my hosting solution. I have a rails 3 application that dynamically accepts mp3 (and other media) and creates a ZIP file for download. It works fine in development, but as soon as I put it on my prod server, the zip file is still loading, but when I unzip it, it creates a file called foo-bar.zip.cpgz
heres my controller snippet -
def get_zip
t = Tempfile.new("#{@foobar.slug}-#{request.remote_ip}.zip")
Zip::ZipOutputStream.open(t.path) do |zos|
@foobardownloads.each do |foobardownload|
extension = File.extname(foobardownload.foobardownload_file_name).gsub(/^\.+/, '')
zos.put_next_entry("#{foobardownload.title}.#{extension}")
zos.print open(foobardownload.foobardownload.url).read
end
end
send_file t.path, :x_sendfile => true, :type => 'application/zip', :filename => "#{@foobar.slug}.zip"
t.close
end
source
share