Forum Moderators: phranque

Message Too Old, No Replies

File Download Limit

Can this be done?

         

alb_boy

2:12 am on Apr 2, 2005 (gmt 0)

10+ Year Member



Hello,

I am a new webmaster. I have a website in which I provide many mp3 and video files. These files are killing my bandwidth and I really cannot afford to spend any more money on this site. My question was if I can put a download limit on these files like for example each file can only be downloaded 10 times a day. Or perhaps can I put a download limit on IP addresses (one IP address can download a certain amount of files per day)? If these are possible does anyone know how they can be done? Any help would be appreciated.

rocknbil

4:47 am on Apr 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If visitors have direct access to the files, you can't (that I know if.)

But if you store the files in some hidden location and use a script to go get it, you CAN.

User requests
/video/myvideo.mpg

inside the video directory are two things, a script (perl, php, whatever) and an .htaccess file.

Use the .htaccess file in the same way you'd use is to create a custom 404, except he 404 page is your script. Since myvideo.mpg doesn't actually exist in that directory, the .htaccess file takes the query string (video/myvideo.mpg) and sends it to the script, which checks to see if it's exceeded its limits, then goes to some other location on the server and gets the file.

That's one way. :-)

kaled

11:09 am on Apr 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A download counter that delivers the file using a redirection in the http header, could, in theory, be modified to limit downloads either by IP or by daily totals.

Something like this may already exist. Try

[hotscripts.com...]
[cgi.resourceindex.com...]

You could also try [webmasterworld.com...]

Kaled.

coopster

11:36 am on Apr 2, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, alb_boy.

Apache has a few 3rd party modules that may be of interest. Search [modules.apache.org] for "bandwidth" or "throttle" and a few different options show up.