[Zope] EMail with uploaded attachments, Part II
Dieter Maurer
dieter@handshake.de
Sat, 27 Jan 2001 14:36:01 +0100 (CET)
Klaus Herrmann writes:
> .... "filename" and "headers" of uploaded files ....
> .... filename works fine, and now i found the docs to
> dtml_mime etc. but i didn't figure out how to extract the content type
> out of the .headers ? do i have to do string parsing or is there a
> function / variable?
"headers" is a dictionary (and thereby a mapping from keys to values).
You access the value associated a mapping's "key" with mapping[key].
Thus, in your case, "uploaded_file.headers['Content-Type']"
should give you the content type provided the browser has sent it.
By the way, most mappings (and certainly all dictionaries)
provide methods "keys", "values" and "items" to obtain
information about the mapping as lists.
With then, you can analyse, what the browser did send you.
Dieter