Well... you just had an excelent idea. Although I need to account used traffic, I can simply store the file sizes on the database. I would put the files on a directory that would not be accessible by the browser... same thing applies to the images. Everytime I wanted to download a file, I would call something like
http://www.myhost.com/download.php?id=234234234
What I have in mind for the files table is:
- id
- user
- filename
- filetype
- filesize
- content (if I would use the DB-storing sollution)
As for the images, I would do it the following way
- id
- user
- filename
- width
- height
- filesize
- format (jpeg, gif, whatever)
- content (if using the db-storing sollution)
I don't want users to be able to access the files directlly, because as i've said before, I need to account in a fast way the bandwidth used. This way I would add the file's size to the used bandwidth field, send the appropriate header (according to the file's type) and dump the file's content.
Thanks for your heads up 🙂