Store all files in a 'secret' folder, preferably outside the www-root.
Store filename, size, type, date, whatever in your dB.
To link to a file, use something like this <a

Then in download.php you update your stats table with the relevant info and
then send the file to the user.

| download.php |

$filename = getfilenamefromdb($_GET['id']);
$filetype = getfiletypefromdb($_GET[id]);
$completefilepath = "/your/path/here/$filename";

header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header("Content-type: application/octet-stream\nContent-Disposition:inline;

$fd = fopen($filename,'r');
This is not complete and I'm not really sure about the headers, but you can
read more at http://www.php.net/manual/en/function.fpassthru.php


> -----Original Message-----
> From: JJ Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 03, 2002 2:05 PM
> Subject: [PHP] Simple Example of Passing on a file through a 
> PHP script
> I want to show info when my docs are viewed though my stats 
> program. I have
> decieded the best way would be to put the info into a DB 
> through php file
> then output the PDF, Excel, Zip or Powerpoint file.
> Only trouble is I have no Idea how to do this
> --
> JJ Harrison
> www.tececo.com
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to