September 3rd, 2000, 03:09 PM
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.
September 3rd, 2000, 05:02 PM
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
September 4th, 2000, 07:45 AM