From: Detlef Reichl Date: 2007-11-05T01:28:33+09:00 Subject: send file from CGI Hi, in a webapplication, a user can select from some options. Depending on the selection some files are packed together in a zip file and get send to the user. So far it works perfect, but the zip file is not recognized from the browser and it displays the data as garbage. The code that sends the data: print @cgi.header("type" => "application/zip") print @cgi.header("length" => File.size(zipfile).to_s) file = File.new(zipfile, "r" ) while true begin data = file.sysread(65536) rescue EOFError break else @cgi.print data end end Any suggestions? Cheers detlef