[Zope] help with detecting mime_type
Alan
alanwilter at gmail.com
Thu May 24 06:31:17 EDT 2007
Dears,
In my external method I can get mime_type =
file.headers.headers[1].split()[1] and then my code proceed based on
which mime type was identified for the file uploaded.
What happens now is that a user uploading a tgz file from a Windows
platform and then my code did not identify it as a
application/x-gzip-compressed or similar (it gets
application/octet-stream).
As far as I understood from this case, such mime type info is passed
by user's system (where Windows usually is not aware of tar.gz, tgz
etc format) rather than being set by zope server.
So since I was not aware of that, my question is: does anyone know a
better and reliable way of identifying a file mime type (or a file
format) independent from which platform/browser it is submitted?
I realise I can use a conditional for checking extension file name in
addition to mime type detection. But I would go for that only if I
cannot find anything fairer.
Many thanks in advance.
Alan
--
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<
More information about the Zope
mailing list