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

    Join Date
    Sep 2000
    Posts
    1
    Rep Power
    0
    How do I ptogram with PHP a link that when clicked starts downloading the file?
    Basically I dont want to link directly as I want to take note of the number of times a file is downloaded so I need some way of sending the file back to the browser after I have done some housekeeping.
    Just like the download link on www.php.net/downloads page.
    Thanks, alan.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    <guessing>

    you click to download.php and pass in a ID/name for the file (the file can be in either a DB or physically on the server)

    you do your logging, i.e. someone just clicked to download app.tar.gz

    you send a header 'header("Content-type: my-mime-type");

    you either do a select from your database to find the file, or you use fopen() etc, to read the file in form the disk,

    you print the raw data to the browser

    </guessing>

    hth

    Bealers

    ------------------
    http://back-end.org
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Herne Bay, Kent, UK
    Posts
    30
    Rep Power
    15
    I have a feeling it's done in Javascript. Have a look at any of the download pages at www.download.com as they seem to use JS to do it...

Similar Threads

  1. Replies: 3
    Last Post: February 25th, 2004, 02:10 AM
  2. Domain Controller Swapping
    By estekguy in forum Windows Help
    Replies: 2
    Last Post: February 5th, 2004, 01:46 PM
  3. consecutive downloads with one click
    By HusNu in forum HTML Programming
    Replies: 0
    Last Post: January 11th, 2004, 11:57 PM
  4. changing a daily count on downloads
    By gkg1 in forum PHP Development
    Replies: 2
    Last Post: November 26th, 2003, 04:59 PM
  5. How To Screen Your Visitors When Using Pay Per Click Advertising
    By Rich Hamilton in forum Search Engine Optimization
    Replies: 0
    Last Post: November 21st, 2003, 01:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo