473,385 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Bandwidth and download question

Hello,

I have a website that is hosted by another company. Is there some kind
of php script to limit downloading to a certain amount size? And is
there kind thing I can do to the .htaccess file to limit this as
well???

For example I have a little media file say about 3MB or something.
Once someone visits the site and wants to download this file (ie.
http://www.domain.com/dir/file.wmv), I would like something check
something to see if they have the max download per day before it lets
them download it.

thanks for any help.

Jul 17 '05 #1
6 1815
I also want to add, it doesn't have to limit the wmv file, whatever
file is in a directory as well.

Jul 17 '05 #2
"Samir" <dl*****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I also want to add, it doesn't have to limit the wmv file, whatever
file is in a directory as well.


This is really something handled better by the webserver software (i.e.
apache). It COULD be done w/ PHP, but it would be a little tricky.

-Joe
Jul 17 '05 #3
NC
Samir wrote:

I have a website that is hosted by another company.
Is there some kind of php script to limit downloading
to a certain amount size?


This is not a trivial task. It is possible to create a
script that will keep track of files that users ATTEMPTED
to download. Whether those downloads succeeded or not is
difficult to tell from the server side...

Cheers,
NC

Jul 17 '05 #4
Where would the best place to do? Can you give me some pointers and
hints?

Jul 17 '05 #5
NC
Samir wrote:

Where would the best place to do? Can you give me some
pointers and hints?


OK, if I understand your problem correctly, you need an
application with four major functions:

1. Authorization
A user must provide valid credentials (login name and
password) before using the service. User data (login
name, hash of password, e-mail address and any other
information you require at sign-up) should be stored
in a database table. If you plan to have different
download quotas for different users, this should also
be reflected in this table.

2. File storage
Files should be stored in a directory protected from
direct access via HTTP (either located outside of document
root or blocked with a "deny from all" directive in
an .htacces file). Basic information about files
(name, size, and perhaps MIME type) shoule be stored
in another database table.

3. Accounting and delivery
Downloads should be implemented via PHP script. Let's
say a properly authorized used requests file whose
ID number is 234. A query executed on the file
storage data table returns that file number 234 is
named 'somesong.mp3', is 1,234,567 bytes long, and
has a MIME type 'application/mp3'. Then, you can
implement the download like this:

header('Content-Type: application/mp3');
header('Content-Disposition: attachment; filename=somesong.mp3');
header('Content-Length: 1234567');
readfile('files/somesomg.mp3');

Direct downloads from file storage directory should not
be allowed. Every attempted download via script should
be recorded in a third database table listing user ID,
time of download, and the ID of file being downloaded.
Prior to the commencement of the download, a check should
be run on whether the user has exceeded his/her download
quota.

4. Administration
The project administrator (meaning, you) should have
a Web interface for file uploads, managing users, etc.

Scared yet? :)

Cheers,
NC

Jul 17 '05 #6
Thanks for all the info...I am testing out the phpnuke, it is something
I am going for. I have managed to set up links in a hidden directory
for download and disguise the link as well. I finished writing the
script by checking whether or not they are a registered user or not as
well. I learned quite a bit. I did things a little differently but I
like the ways yours was written as well for hiding the download file.

Just one more thing I guess, Is there a way to deteremine whether a
file has finished downloading or not. I just don't want to count the
click as a download without knowing whether the download completed or
just cancled by the user. I think I am trying to say I would like to
know if there is a way to count how many bytes the user has taken at
the finish of the dowload or cancel button.

Thanks again:)

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martin Raychev | last post by:
Hi everybody, I have a need for a web app that will allow a flash client to download files at a specified speed. I am using Flash for an application of mine which downloads JPG slides to...
3
by: Tim | last post by:
Hi Group, Apologies if this is a bit OT (if so, please advise where it should be posted). I was wondering if anyone had any ideas as to what applications could work in a system where the...
2
by: hoenes1 | last post by:
Hi all, I have an asp.net application from which registered users can download files. What I want to implement is a bandwidth restriction for certain users. What I DON'T want to do is restrict...
8
by: Dominic Martin | last post by:
Hi, I need to setup an ODBC link over our Internet connection between MS Access (local) and a MySQL server (Remote - the local PC has the MySQL ODBC driver installed). What kind of bandwidth...
9
by: Chibi | last post by:
I'm writing an application that's bandwidth intense. My available bandwidth is 1.5Mbps (cable modem) and I know I can reach around 1.4Mbps, if not more. The application I am writing right now...
3
by: Raj | last post by:
is it possible using C# dotnet to control the bandwidth usage means the transfer rate of download and upload? Thanks!
3
by: jcvoon | last post by:
Hi: My customer request me to provide how much bandwidth required by my application (For both Winform and Asp.net application). I've no idea how to measure it. Please advice. Thanks JCVoon
7
by: Andrew Poulos | last post by:
Is there a way where I can "guess" what relative speed the user's connection is? Currently, the client is wanting some graphical intensive content and I'd like to be able to warn users on...
4
by: Zytan | last post by:
This may be the dumbest question of all time, but... When I set the packet size, does it mean ALL packets are that size, no matter what? Let's say the packet size is 8KB, and I send a 5 byte...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.