Detecting how many people are downloading a file

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
gottasee
Forum Newbie
Posts: 3
Joined: Thu Feb 24, 2005 2:55 pm

Detecting how many people are downloading a file

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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...
gottasee
Forum Newbie
Posts: 3
Joined: Thu Feb 24, 2005 2:55 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
gottasee
Forum Newbie
Posts: 3
Joined: Thu Feb 24, 2005 2:55 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search for things on "force download"
Post Reply