create a script getFile.php

when this is called first update the database, then  using header you can
stipulate what type of document it is and it will prompt for download
for example  for a Word document
<?php

    #Query here to update the database

    #then after successful  output the headers that will prompt for download

    # $data  is the raw data of the document either from an fopen or from
the database
    Header( "Content-type: application/msword");
    Header('Content-Length: ' . strlen($data));
    Header('Content-Disposition: attachment; filename="document.doc"');

    echo $data;

?>

Notes:
make sure you don't echo anything before the headers even suppress any
errors that may come from query
you can call the script through the web page as follows
<a href ='getFile.php'> Click here to download the document </a>


"Mark Roberts" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I need to provide a way for users to download data files from a web site.

I know that I could have then right click and save-as, however, I need to
record this action in a database. If they just right click, I don't have any
way to trigger the script to record the transaction.

Does some one have a good way to do this, or at least give me some ideas?
Thanks.

Mark Roberts
Sr. Systems Analyst







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

Reply via email to