#1
  1. No Profile Picture
    Immortalus
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi,
    I have written a script, which basicly is a addressbook. I have included a funcion, which sends a CSV-file to the browser.
    It's doing this by using "Header("Content Type: application/octet-stream").
    The problem is, that the incomning file is named like the script - isn't there any header you can send, so the file's name by default would be list.csv or something...my users aren't computer experts and they get confused!
  2. #2
  3. No Profile Picture
    cbolt
    Guest
    Devshed Newbie (0 - 499 posts)
    header("Content-disposition: filename=list.csv");
    header("Content-type: application/octet-stream");

    They must be in that order too... php does things backwards.
  4. #3
  5. No Profile Picture
    Immortalus
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanx mate,

    just what I sought for
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    58
    Rep Power
    15
    Looked at this example and other, but it didn't help me.
    If myfile.php contains this only:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?php
    header("Content-disposition: filename=somefile.csv");
    header("Content-type: application/octet-stream");
    ?>
    [/code]

    The Save as dialog appearce fine, but it saves a file that is 0 in size and contains nothing.

    What else should the code contain? Help, please.

    ------------------

    peterbe.com
  8. #5
  9. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You have to send the data, too.

Similar Threads

  1. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 08:27 AM
  2. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 06:06 AM
  3. if/ else statement in .inc file
    By tragnark in forum PHP Development
    Replies: 3
    Last Post: February 9th, 2004, 12:22 PM
  4. Replies: 1
    Last Post: February 8th, 2004, 01:59 PM
  5. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 07:42 PM

IMN logo majestic logo threadwatch logo seochat tools logo