2 ################################################################################
4 # FSWiki Lite - źÉÕ¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤¿¤á¤ÎCGI¥¹¥¯¥ê¥×¥È
6 ################################################################################
7 require "./lib/common.pl";
8 #==============================================================================
10 #==============================================================================
15 #==============================================================================
17 #==============================================================================
19 &Util::error("¥Ú¡¼¥¸¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
22 &Util::error("¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£");
24 #==============================================================================
26 #==============================================================================
27 my $filename = sprintf("$main::ATTACH_DIR/%s.%s",&Util::url_encode($page),&Util::url_encode($file));
29 &Util::error("»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ï¸ºß¤·¤Þ¤»¤ó¡£");
32 my $contenttype = &get_mime_type($file);
33 my $ua = $ENV{"HTTP_USER_AGENT"};
34 my $disposition = ($contenttype =~ /^image\// && $ua !~ /MSIE/ ? "inline" : "attachment");
36 &jcode::convert(\$file,'sjis');
38 print "Content-Type: $contenttype\n";
39 print "Content-Disposition: $disposition;filename=\"$file\"\n\n";
48 #==============================================================================
49 # MIME¥¿¥¤¥×¤ò¼èÆÀ¤·¤Þ¤¹
50 #==============================================================================
53 my $type = lc(substr($file,rindex($file,".")));
56 if ($type eq ".gif" ){ $ctype = "image/gif"; }
57 elsif($type eq ".txt" ){ $ctype = "text/plain"; }
58 elsif($type eq ".rb" ){ $ctype = "text/plain"; }
59 elsif($type eq ".pl" ){ $ctype = "text/plain"; }
60 elsif($type eq ".java"){ $ctype = "text/plain"; }
61 # elsif($type eq ".html"){ $ctype = "text/html"; }
62 # elsif($type eq ".htm" ){ $ctype = "text/html"; }
63 elsif($type eq ".css" ){ $ctype = "text/css"; }
64 elsif($type eq ".jpeg"){ $ctype = "image/jpeg"; }
65 elsif($type eq ".jpg" ){ $ctype = "image/jpeg"; }
66 elsif($type eq ".png" ){ $ctype = "image/png"; }
67 elsif($type eq ".bmp" ){ $ctype = "image/bmp"; }
68 elsif($type eq ".doc" ){ $ctype = "application/msword"; }
69 elsif($type eq ".xls" ){ $ctype = "application/vnd.ms-excel"; }
70 else { $ctype = "application/octet-stream"; }