ダウンロードすることができません。
Internet Explorerこのサイトを開くことができませんでした。
要求されたサイトが使用できないか見つかりません。後でもう一度やり直してください。
#!/usr/local/bin/ruby
ENV['GEM_HOME']='/home/hogehoge/local/lib/gems/1.8'
require 'cgi'
require 'uri'
require 'kconv'
require "erb"
require 'rubygems'
require 'prawn'
cgi = CGI.new('html3')
pdf=Prawn::Document.new
pdf.font '../ipag.ttf'
if cgi.has_key?('str') then
pdf.text(URI.unescape(cgi['str']).toutf8)
header={
'status'=>'OK',
'type'=>'application/pdf',
'Content-Disposition'=>'attachment; filename=hoge.pdf',
'pragma'=>'no-cache', #IE6ではこれも不要。
'cache-control'=>'no-cache,must-revalidate', #IE8ではこれが問題
'Accept-Ranges'=>'bytes'
}
header.delete('cache-control') if /MSIE/i=~ENV['HTTP_USER_AGENT'] #IE対策
header.delete('pragma') if /MSIE/i=~ENV['HTTP_USER_AGENT'] #IE対策
body=pdf.render
else
header={'type'=>'text/html; charset=utf-8'}
body=cgi.html(){cgi.body(){ERB.new(DATA.read).result}}
end
cgi.out(header){
body
}
__END__
<a href='<%=ENV['SCRIPT_NAME']%>?str=I%20hate%20IE%2e'>Down Load</a>
Author:kovayashi
・嫌いなもの
→好きなもの
・インストール
→バンドル
・バックアップ
→アップロード
コメントの投稿