It was pointed out to me that I really should have posted the solution.  I
thought about it, but it was so simple, I felt a bit embarrassed <blush>

Instead of just calling the text file, I need to call it within another perl
program.  Within this, the Content-type needs to be set as
application/octet-stream, not data/text (code below).  This forces it to
download, though, alas, as a perl file initially, not a txt file.  However,
it opens up as a text file.  Rummy!

Cheers

Di



my $url = $ENV{'QUERY_STRING'};  # Passed report location through as a
querystring
my $tourl = "../../client/htdocs/reports/$url";
my $HTML = "";


print STDERR "$tourl\n";
if (! open (FIN, "<$tourl"))  {
        $HTML = "<H2>ERROR</H2><P>Could not open report at this time";
        die "Could not open input file $tourl : $!";
} else {
        $HTML = join("", <FIN>);
        close(FIN);
print STDERR "$HTML\n";
}


print "Content-type: application/octet-stream\n";
print "$HTML";


exit(0); 

Reply via email to