in reply to Naming a Worksheet in Perl

You need to add a Content-disposition header:

print "Content-type: application/vnd.ms-excel; 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)

brad

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.

    --
    Clayton

      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...