On Sun, 24 Aug 2003 at 03:04, zsdc opined:
z:fliptop wrote:
z:
z:> merrill - i'm a little late on this thread, and the other suggestions are
z:> valid, but here's one way to serve up files w/o using a direct link by
z:> taking advantage of CGI.pm's header() function:
z:>
z:> my $cgi = new CGI;
z:> print $cgi->header('application/pdf');
z:
z:Actually, it's the same as just:
z:
z: print "Content-Type: application/pdf\n\n";
z:
z:CGI.pm is great but it's an overkill for just printing HTTP Content-Type
z:header.
that is true, however i cut the code out of a script i had handy. the
params are passed in as such:
/cgi-bin/mime.cgi?filename=whatever&mime_type=application%02Fpdf
so the full file looked something like this:
use CGI;
my $cgi = new CGI;
my $filename = $cgi->param('filename');
my $mime_type = $cgi->param('mime_type');
print $cgi->header($mime_type);
open OUT, $filename;
my $buffer;
while (my $read = read(OUT, $buffer, 4096)) {
print $buffer;
}
close OUT;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]