Page 1 of 1

Detecting how many people are downloading a file

Posted: Thu Feb 24, 2005 3:02 pm
by gottasee
Hi All

I'm running PHP4 latest and Apache 2 latest and MySQL Latest on my server.

What I want is a PHP program to detect how many poeple are downloading a certian file from my server a point in time.

Basically i want a PHP script to check if 3 people are downloading a file from my server and if 3 or more are then download the file from another server.

Does anyone know if this can be done? if so i would really like to know how.

I'm fine with re-directing the URL but how could i detect with Apache how many people are downloading that file?

Thanks All

Posted: Thu Feb 24, 2005 3:19 pm
by feyd
it may be easier to create a download helper script that makes a log of when someone downloads it.

There is a potential to read the access logs from apache if it allows it...

Posted: Thu Feb 24, 2005 3:45 pm
by gottasee
Will the logs be able to tell me when the downloads finished?

I basically want to be able to detect how many people are downloading at that point in time.

Cheers for the logs idea I'll look into that it may work.

Posted: Thu Feb 24, 2005 4:33 pm
by feyd
no, they will not tell you when they finished. The most they can tell you is how much data was sent. But that doesn't bare a thing to how much data was recieved.

if you use a download script, you should be able to easily track when data is being sent out, via setting a flag or something that says they are downloading. When the script finishes, you can mark them as finished..

Posted: Thu Feb 24, 2005 5:22 pm
by gottasee
How would the script work?

I thought i would just navigate the user to the file which would bring up a box to save.

How would i write such a script to download the file and then run more code after.

Posted: Thu Feb 24, 2005 5:34 pm
by feyd
search for things on "force download"