View Full Version : query about file downloading

02-10-2006, 03:13 PM
Hi all
i have two sections in my project
1; admin
2; site users
i m providing the facility for users to come to my site and download files.
all the users have credit accounts. when a user downloads a file, his account will be minus by one credit and the account of admin will be plus by one credit.
its all working fine for me.
the problem is
how i come to know that a user has just opened the file or he has download it.
bcoz in my case, whether a user opens, downloads the file or even cancels , the account gets plus by one.

02-10-2006, 03:18 PM
I was actually thinking about this the other day. I was wondering if doing something like this would solve your problem:

header('Content-type: the/proper/type/goes/here');



if that won't do it then I'm not sure what will. oh, and on that note, anyone know if doing an fgets+ob_flush would let one control the speed of the download?

02-10-2006, 03:19 PM
You cannot detect that.

All you can detect is that the command was processed.

If you use content headers to force a download then when the file is requested it will prompt the user to open or download the file.

As soon as this prompt is given then it's upto the user to open or cancel. Your script has done it's job.