to figure out the correct MIME type for the file, you
could use the File::MMagic module (there's no way i
would use the MIME type sent in the client HTTP request,
since many browsers these days seem to be horribly
misconfigured w.r.t. MIME). i'm not sure how well it works
under non-UNIX platforms, but it does have an 'external
file' mode which i believe could be used under Windows with
the /etc/magic file from a Linux distro, if
necessary.
if you can't figure out what the correct MIME type is,
it is probably better to use
application/octet-stream instead of
unknown/unknown.