Submit Your Article Forum Rules

Results 1 to 2 of 2

Thread: How to keep track of downloads ?

  1. #1
    Junior Member
    Join Date
    Jun 2004
    Posts
    7

    How to keep track of downloads ?

    Hi there.

    I've come across a problem. I want to keep an exact track of my downloads, so i know precisely how many are each day and so on....

    How do i do this in html + php?

    I mean how do i do this so:
    - it won't need an aditional page, with just a huge link on it that says "click here to begin"
    - the stuff won't be stopped by popup blockers
    - when the user clicked the link or button or whatever, the download will start and a php file will be called immediately so i can add the click to a database

    Any idea guys?

  2. #2
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    Assuming you are downloading ZIP files:
    Code:
    <?php
    
    // Add counter update code here
    
    // Send the file
    header("Content-Disposition: filename=\"thefilename.zip\"");
    header("Content-Type: application/zip");
    @readfile('/path/thefilename.zip');
    
    ?>
    On your page make the link point to this PHP file rather than the actual file.

    If you are not downloading ZIPs then you will need to change the Content-Type appropriately.

Similar Threads

  1. CSV File Downloads in IE8
    By 1dmf in forum Web Programming Discussion Forum
    Replies: 10
    Last Post: 11-24-2009, 02:49 PM
  2. File downloads
    By rkstevens in forum Web Programming Discussion Forum
    Replies: 4
    Last Post: 03-26-2008, 07:58 AM
  3. 3D Downloads
    By mrsjordanjr in forum Graphics & Design Discussion Forum
    Replies: 0
    Last Post: 02-07-2006, 02:54 PM
  4. How do I provide PDF downloads
    By Gregse in forum Graphics & Design Discussion Forum
    Replies: 5
    Last Post: 10-09-2005, 10:45 PM
  5. Automatic Downloads
    By dabblingmum in forum Web Programming Discussion Forum
    Replies: 2
    Last Post: 05-27-2004, 07:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •