Leser: 1
|< 1 2 >| | 14 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
sub get_filename
{
my ($file) = @_;
$file =~ s!\\!/!g; # chnage windows path as needed
my @parts = split /\//, $file;
return pop @parts;
}
sub send_file_to_browser
{
my ($file) = @_;
my $name = get_filename($file);
$name =~ s! !%20!g;
$name ||= "[N/A]";
print "Content-Disposition: inline; filename=\"$name\"\n";
print "Content-Type: application/octet-stream\n\n";
send_binaryfile_to_browser($file);
1;
}
sub send_binaryfile_to_browser
{
my ($file) = @_;
binmode STDOUT;
if(open(FILE, "< $file"))
{
binmode FILE;
while(<FILE>) { print $_; }
close FILE;
}
}
Quoteprint "Content-Disposition: inline; filename=\"$name\"\n";
1
2
3
4
5
6
if($ENV{PATH_INFO}) {
print "Content-Type: application/octet-stream\n\n";
print $inhalt;
} else {
print "Location: http://host/cgi-bin/script.pl/$dateiname\n\n";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
my $dest = 'c:/inetpub/wwwroot/cgi-bin/the_script.pl';
send_file_to_browser(\$dest);
##################################
sub send_file_to_browser {
##################################
my $dest = shift;
my ($file, @path);
local $_;
chomp $$dest;
$$dest =~ s/\\/\//g;
@path = split /\//, $$dest;
($file = $path[-1]) =~ s/\s/_/g;
binmode STDOUT;
print "Content-Type: application/*\n";
print "Content-Disposition: inline; filename=\"$file\"\n\n";
open FILE, "< $$dest" or die("File $file couldn't be opened");
binmode FILE;
print while <FILE>;
close FILE or die("File $file couldn't be closed");
}
RewriteRule /download/(.+)/(.*) /perl-bin/download.pl?file=$1;$2
|< 1 2 >| | 14 Einträge, 2 Seiten |