[PHP] download a textfile

Discussion in 'Web Design & Coding' started by Glaanieboy, Jul 18, 2004.

  1. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    When you upload a text file on the forum and download it again, my browser comes up with a download window, asking me where to download this file etc. But how do you do that in PHP? Or is there another way then PHP to do that? Javascript maybe?
     
  2. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
  3. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Thanks SPeedY_B. It's pretty much the same answer as I found myself :p
    header('Content-type: plain/text');
    header('Content-Disposition: attachment; filename="bleh.txt"');