#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Göteborg, Sweden
    Posts
    9
    Rep Power
    0
    Hi

    I need some code that will download a certain file, no matter what type it is. Currently, if it's say a .txt file it will open it in the browser, not download it. Is there a way to fix this in PHP?

    Thanks


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

    ::cj.kihlbom:: cj@kihlbom.com ::
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    see the following discussion..
    http://www.devshed.com/Talk/Forums/F...ML/000607.html


    search for "file download" in this forum you will get lot of threads with similar topic.


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Göteborg, Sweden
    Posts
    9
    Rep Power
    0
    Thanks for the tip, but the code I found didn't work.

    This is what I use:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?PHP
    if ($startdownload == "yes") {
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=$dfilename");
    header("Content-Transfer-Encoding: binary");
    header("Location: <A HREF="http://kihlbom.com/afk/download/$dfilename");" TARGET=_blank>http://kihlbom.com/afk/download/$dfilename");</A>
    exit;
    }
    ?>
    [/code]

    Any ideas why?


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

    ::cj.kihlbom:: cj@kihlbom.com ::
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Göteborg, Sweden
    Posts
    9
    Rep Power
    0
    Please, is there someone who has gotten the above to work? I'm badly in need of this.



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

    ::cj.kihlbom:: cj@kihlbom.com ::

Similar Threads

  1. files downloading to temp directory.
    By mr_______bond in forum PHP Development
    Replies: 2
    Last Post: February 15th, 2004, 05:32 PM
  2. Help required with htm files downloading in browser
    By Wreck in forum HTML Programming
    Replies: 6
    Last Post: February 14th, 2004, 03:30 PM
  3. Problem downloading files
    By dcerrone in forum Windows Help
    Replies: 0
    Last Post: December 11th, 2003, 09:19 AM
  4. Downloading files from non-publicly accessible directory
    By rlorenzo in forum PHP Development
    Replies: 3
    Last Post: December 2nd, 2003, 06:34 PM
  5. downloading files [mp3's]
    By chriszanf in forum PHP Development
    Replies: 2
    Last Post: November 16th, 2003, 08:38 AM

IMN logo majestic logo threadwatch logo seochat tools logo