Jump to content


Photo

how to detect file download?


  • Please log in to reply
2 replies to this topic

#1 realjumper

realjumper
  • Members
  • PipPipPip
  • Advanced Member
  • 399 posts

Posted 02 March 2006 - 11:07 PM

Hi,

My little application is a simple file upload system. There is only ever going to be one user who will upload, and one user who will download the file. There is also an archive of current uploaded files for the download person, and a separate archive page for the uploader which is the same, but includes a delete function to delete the db record and also to delete the actual file. When a file is uploaded, an email is sent to the person who will download the file when he is ready, by visiting the archive page and choosing which file he wishes to dowload and clicking the 'download' link. So far so good.

What I want to do now is to have a 'Yes'/'No' next to the archive of each file which will let the user know whether the file has been downloaded or not. The question is.....how do I detect if the file has been downloaded or not?

Thanks for any suggestions.

Neil

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 03 March 2006 - 01:31 AM

You can set up a PHP script to feed the browser a download instead of a web page. You just need to set the content-type correctly with the header() function. This script can also record the fact that it was run.

See this page from the PHP documentation for more information:
[a href=\"http://us3.php.net/manual/en/function.header.php\" target=\"_blank\"]http://us3.php.net/manual/en/function.header.php[/a]

#3 realjumper

realjumper
  • Members
  • PipPipPip
  • Advanced Member
  • 399 posts

Posted 04 March 2006 - 04:18 AM

Thanks for that wickning1.....I haven't quite got it sorted yet, but I'm close!! Hopefully I'll have this running very soon.

Cheers,
Neil




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users