in reply to Re: CGI Trying to save file to computer rather then display it in browser
in thread CGI Trying to save file to computer rather then display it in browser

I am always a bit puzzled by the reasons m scripts are offered for download all of a sudden, but I maybe it has something to do with the content-type which you have set to test/html. I have never seen it before. Could it be the correct line should be print "Content-type: text/html\n\n";

This error might have been avoided by using CGI.pm like so:

#/usr/local/bin/perl -wT use strict; use CGI qw(:standard); print header, start_html(-title=>'My Neat Program'), print end_html;
The header shortcut by default spits out "Content-type: text/plain"
  • Comment on Re: Re: CGI Trying to save file to computer rather then display it in browser
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: CGI Trying to save file to computer rather then display it in browser
by Trimbach (Curate) on Apr 29, 2001 at 18:40 UTC
    The header shortcut by default spits out "Content-type: text/plain"
    No, actually "print header" in CGI.pm spits out "Content-type: text/html." You can get CGI to produce text/plain if you want (or any other MIME type for that matter) but text/html is the default.

    Gary Blackburn
    Trained Killer

      Sigh...I hate it when my hands type whatever they want. You are completely correct.