|
Perl Script to Return a file
PERFECT for when you want to hide the URL of the file.
#!/usr/bin/perl
use CGI;
my $cgi = new CGI();
print $cgi->header(-type=>'application/pdf');
open FILE, "../../files/bids/B518024.pdf" or die $!;
binmode FILE;
my ($buf, $data, $n);
while (($n = read FILE, $data, 4) != 0) {
$buf .= $data;
}
close(FILE);
print $buf;
|
|