Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
go ahead... be a heretic
 
PerlMonks  

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

by olly (Scribe)
on Apr 29, 2001 at 09:43 UTC ( [id://76456]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 stuffy (Monk) on Apr 29, 2001 at 10: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.
Re: Re: CGI Trying to save file to computer rather then display it in browser
by virtualsue (Vicar) on Apr 29, 2001 at 10: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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://76456]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.