■こんなCGI作ってください■
■ このスレッドは過去ログ倉庫に格納されています
0308nobodyさん
2005/04/04(月) 13:10:38ID:???#!/usr/bin/perl
$|=1;
require './cgi-lib.pl';
#// SETTINGS //
$base = './data/'; #実際のファイルがあるディレクトリへのパス
&ReadParse(\%in);
$in{'filename'} =~ s/<|>|\||\\|\/|:|\?|"|\0//g;
$file = $base.$in{'filename'};
if(!-f $file){ &error(); }
@stat = stat($file);
print 'Content-Disposition: attachment; filename=', $in{'filename'}, "\n";
print 'Content-Length: ', $stat[7], "\n";
print 'Content-type: application/octet-stream', "\n\n";
open(FH, $file);
binmode(STDOUT);
while (<FH>) { print $_; }
close(FH);
exit;
sub error {
print 'Content-type: text/html', "\n\n";
print 'Error';
exit;
}
■ このスレッドは過去ログ倉庫に格納されています