I already asked this question on the main Zope list, but there was no answer so far; so I hope I find the right audience here...

In my HowTo about dealing with BLOBs <http://www.zope.org/Members/murphy/MySQL-BLOBs> I use a rather unelegant but working method to get the content type of an uploaded file. Stefan Tjarks has now drawn my attention to the Header attributes of the uploaded form data, namely the "Content-Type" attribute which seems to reveal the MIME type (photo.headers['Content-Type'] for the given exsample).
My sorrow is now that this information isn't 100 % reliable, 'cause the Zope core (esp. the Image and File classes) doesn't seem to use this possibility either, but implements it's own methods which I use in the HowTo, too. The responsible class ZPublisher.HTTPRequest.FileUpload seems only to reach through the header information from the browser. Also I've learned through SelfHTML that the MIME type support of browsers has holes sometimes, as described for the accept attribute of the <form> tag.
Does anybody have further information on that issue, and why headers['Content-Type'] isn't used by Zope (it is, in fact, but in ZPublisher for seemingly other purposes)?


Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to