"ファイルのダウンロード"ダイアログ

と書くことで、処理完了ページを表示しつつ、"ファイルのダウンロード"ダイアログを開いて、ファイルを保存させることができる。
ちょっと邪道なやり方のような気がするけど。
で、ハマりメモ。
サーバ:Apache2、クライアント:Firefox 2.0の場合は、test.csvをブラウザで表示してしまった。
下記HTTP応答を見ると、Content-Type: text/plainになっているためのようだ。
httpd.confあたりで、"AddType text/csv .csv"とか書いてあげると一応解決。

IE 6 + ieHTTPheadersでHTTP応答の内容を確認

GET /test.csv HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; istb 644; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Host: 127.0.0.1
Connection: Keep-Alive
 
HTTP/1.1 200 OK
Date: Mon, 10 Sep 2007 07:30:09 GMT
Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.2 mod_perl/2.0.3 Perl/v5.8.8
Last-Modified: Mon, 10 Sep 2007 04:30:46 GMT
ETag: "133d7-15-73cb5638"
Accept-Ranges: bytes
Content-Length: 21
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/plain

GET /test.csv HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; istb 644; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Host: 127.0.0.1
Connection: Keep-Alive
  
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Mon, 10 Sep 2007 07:18:06 GMT
Content-Type: application/octet-stream
Accept-Ranges: bytes
Last-Modified: Mon, 10 Sep 2007 04:30:46 GMT
ETag: "35de2f5b63f3c71:8cc"
Content-Length: 21

Firefoxでも"ファイルのダウンロード"ダイアログ出た>

GET /test.csv HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: ja
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; istb 644; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Host: 127.0.0.1
Connection: Keep-Alive
 
HTTP/1.1 200 OK
Date: Mon, 10 Sep 2007 07:22:06 GMT
Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.2 mod_perl/2.0.3 Perl/v5.8.8
Last-Modified: Mon, 10 Sep 2007 04:30:46 GMT
ETag: "133d7-15-73cb5638"
Accept-Ranges: bytes
Content-Length: 21
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/csv