two header questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Branko Kaucic

    two header questions

    Hi!

    Is it possible to generate an export file and still showing different
    HTML page??

    I have a page and when the user clicks on a link I generate export file
    (with header and data after header) and the page remains the same. It
    would be nice if I could show another page, like message "data generated!".

    And I have another question. I have the following code for sending
    export file:

    header("Content-Disposition: attachment; filename=export .txt");
    header("Content-Type: application/octetstream");
    header("Pragma: no-cache");
    header("Expires : 0");
    echo $Data;

    but when the Save as dialog appears I get filename "export.txt.php ".
    What must I do to get the right filename "export.txt "?

    Thanks,
    Branko

  • ^MisterJingo^

    #2
    Re: two header questions

    "Branko Kaucic" <branko.kaucic@ uni-mb.si> wrote in message
    news:bfe707024i d@enews2.newsgu y.com[color=blue]
    > Hi!
    >
    > Is it possible to generate an export file and still showing different
    > HTML page??
    >
    > I have a page and when the user clicks on a link I generate export
    > file (with header and data after header) and the page remains the
    > same. It would be nice if I could show another page, like message
    > "data generated!".
    >
    > And I have another question. I have the following code for sending
    > export file:
    >
    > header("Content-Disposition: attachment; filename=export .txt");
    > header("Content-Type: application/octetstream");
    > header("Pragma: no-cache");
    > header("Expires : 0");
    > echo $Data;
    >
    > but when the Save as dialog appears I get filename "export.txt.php ".
    > What must I do to get the right filename "export.txt "?
    >
    > Thanks,
    > Branko[/color]

    Perhaps trivial but have you tried:

    header("Content-Disposition: attachment; filename='expor t.txt'");

    putting single quotation marks around the file name and extension?... I'm
    not sure if this will work but it's worth a try.


    Comment

    • Branko Kaucic

      #3
      Re: two header questions

      Sorry, this doesn't work. Now I get filename 'export.txt'.ph p. Any other
      idea?
      What about showing HTML file?

      Thanks,
      Branko

      ^MisterJingo^ wrote:[color=blue]
      > "Branko Kaucic" <branko.kaucic@ uni-mb.si> wrote in message
      > news:bfe707024i d@enews2.newsgu y.com
      >[color=green]
      >>Hi!
      >>
      >>Is it possible to generate an export file and still showing different
      >>HTML page??
      >>
      >>I have a page and when the user clicks on a link I generate export
      >>file (with header and data after header) and the page remains the
      >>same. It would be nice if I could show another page, like message
      >>"data generated!".
      >>
      >>And I have another question. I have the following code for sending
      >>export file:
      >>
      >> header("Content-Disposition: attachment; filename=export .txt");
      >> header("Content-Type: application/octetstream");
      >> header("Pragma: no-cache");
      >> header("Expires : 0");
      >> echo $Data;
      >>
      >>but when the Save as dialog appears I get filename "export.txt.php ".
      >>What must I do to get the right filename "export.txt "?
      >>
      >>Thanks,
      >>Branko[/color]
      >
      >
      > Perhaps trivial but have you tried:
      >
      > header("Content-Disposition: attachment; filename='expor t.txt'");
      >
      > putting single quotation marks around the file name and extension?... I'm
      > not sure if this will work but it's worth a try.
      >
      >[/color]

      Comment

      • Janwillem Borleffs

        #4
        Re: two header questions


        "Branko Kaucic" <branko.kaucic@ uni-mb.si> schreef in bericht
        news:bfghmt0b8l @enews1.newsguy .com...[color=blue]
        > Sorry, this doesn't work. Now I get filename 'export.txt'.ph p. Any other
        > idea?
        > What about showing HTML file?
        >[/color]

        Turn the first two headers around and change the content type setting:

        header("Content-Type: plain/text");
        header("Content-Disposition: attachment; filename=export .txt");
        ....


        JW




        Comment

        • Janwillem Borleffs

          #5
          Re: two header questions

          "Branko Kaucic" <branko.kaucic@ uni-mb.si> schreef in bericht
          news:bfghmt0b8l @enews1.newsguy .com...[color=blue]
          > Sorry, this doesn't work. Now I get filename 'export.txt'.ph p. Any other
          > idea?
          > What about showing HTML file?
          >[/color]

          Turn the first two headers around and change the content type setting:

          header("Content-Type: plain/text");
          header("Content-Disposition: attachment; filename=export .txt");
          ....


          JW



          Comment

          Working...