Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Naming a Worksheet in Perl

by bgreenlee (Friar)
on Aug 10, 2004 at 10:59 UTC ( [id://381514]=note: print w/replies, xml ) Need Help??

in reply to Naming a Worksheet in Perl

You need to add a Content-disposition header:

print "Content-type: application/; CHARSET=x-sjis\n"; print "Content-disposition: attachment; filename=yourfilename.xls\n\n" +;

(note that I moved the double newline to after the content-disposition header; two newlines tells the browser that you're done sending headers)


Replies are listed 'Best First'.
Re^2: Naming a Worksheet in Perl
by clscott (Friar) on Aug 10, 2004 at 15:31 UTC

    bgreenlee's solution is the one that I use and has been recommened to me by others. It saves the pain of the redirect.


      This is a good option, if you clearly know its limits:

      • dixit RFC 2616 (HTTP/1.1):

        Content-Disposition is not part of the HTTP standard, but since it is widely implemented, we are documenting its use and risks for implementors.
      • dixit Java Enterprise Best Practices:

        The bad news is that [...] many browsers second-guess the server's directives and do what they think is best rather than what they're told. These browsers--including Microsoft Internet Explorer and Opera--look at the file extension and "sniff" the incoming content. If they see HTML or image content, they inline-display the file contents instead of offering a Save As dialog.

      I just wanted to be rigorous. BTW last reference explains how to circumvent browser oddities with Content-disposition.

      HTH, Dominique
      My two favorites:
      If the only tool you have is a hammer, you will see every problem as a nail. --Abraham Maslow
      Bien faire, et le faire savoir...

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-05-26 18:22 GMT
Find Nodes?
    Voting Booth?

    No recent polls found