Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

(Guildenstern) Re: Getting CGI to name a file it returns

by Guildenstern (Deacon)
on Jul 16, 2001 at 20:58 UTC ( #97087=note: print w/replies, xml ) Need Help??

in reply to Getting CGI to name a file it returns

Another way to do it is to use the Content-Disposition header.
Set the mimetype to "application/octet-stream", then add a header like this: "Content-Disposition: inline;filename=$filename\n".
Be sure to set the "Content-Length" header as well.

Negaterd character class uber alles!

Replies are listed 'Best First'.
Re: (Guildenstern) Re: Getting CGI to name a file it returns
by Torgo (Beadle) on Jul 16, 2001 at 22:12 UTC
    Aha. I was sure there was a way to do it without faking out stupid browsers... there'd be hell to pay if ever anyone actually made a good, smart browser!

    Now that I know what to look for, I was searching through, I found some code dealing with Content-Disposition, and looks like they've got it covered through the Attachment parameter:
    print $query->header(-type=>'application/octet-stream', -attachment=>'foo.doc');

    I write the code while the master is away!
Re: (Guildenstern) Re: Getting CGI to name a file it returns
by one4k4 (Hermit) on Jul 17, 2001 at 16:31 UTC
    inline;filename=$filename is exactly how I did things in this thread. It works great. When the user is first prompted to save the file, it says whatever.cgi, but when they click save (insted of "open from..") it has the correct file name ($filename).

    Just my $0.02

    _14k4 - (

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://97087]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2022-05-21 05:57 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (76 votes). Check out past polls.