I am trying to build an automated system where a member can download any file that we have for them, we may have any type of file, examples may include:
pdf
gif
jpg
html
csv
txt
php
cgi
.zip
.tar
so, they could be binary files or they may be ascii only files. My question is this, since I want to count how many times the file is downloaded, when I print the file to the browser as an attachment, how do I know if I need to buffer the data or not?
I am using
File::MimeInfo but I don't see how that can tell me if the file is binary or not...
Since I want this to be automated, I don't want to have to just check the extension for file I know for sure we will use, I want it to be automated so no matter what files we put there, it will work... like the list above does not include .psd, what if we wanted to add that one? if we have to hard code each different check, then we limit ourselves.
I would appreciate any pointers for this.
Richard
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.