in reply to 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";

Just a guess.

Imagination is more important then knowledge -Einstein-

  • Comment on Re: CGI Trying to save file to computer rather then display it in browser
  • Download Code

Replies are listed 'Best First'.
Re: Re: CGI Trying to save file to computer rather then display it in browser
by virtualsue (Vicar) on Apr 29, 2001 at 14:26 UTC
    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"
      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.
Re: Re: CGI Trying to save file to computer rather then display it in browser
by stuffy (Monk) on Apr 29, 2001 at 14:16 UTC
    Talk about feeling stupid. Maybe I should find a good editor to proof my scripts. Thanks alot. I looked it over and over, but I couldn't see that. Kind-a like the real part of my job, (the scripting thing is extra)sometimes it takes another set of eyes.