Re: [Zope] Header information on file upload
Florent Guillaume wrote:
The File and Image objects use the Content-Type header on upload if it is provided by the browser. Only if none is provided does it guess one. See OFS.Image.File._get_content_type().
What brings me directly to the central question: Is this Content-Type header provided reliably by every browser? Or: How often must the fallback behaviour be used? Thanks for answers! Martin
On February 2, Martin Gebert wrote:
What brings me directly to the central question: Is this Content-Type header provided reliably by every browser?
Nothing is provided reliably by every browser. (Consider command-line HTTP tools like wget and LWP.) Mostly it depends on how the browser or, more likely, the operating system determines mime types for a file. Windows, for instance, determines the mime type based on file extension, so if you upload an image with the wrong extension (save an image/jpeg as a .gif) IE will send the wrong mime type. Not sure how Macs do it, and most UNIX systems likely use /etc/mime.types. a. -- Adrian van den Dries adriand@flow.com.au Development team www.dev.flow.com.au FLOW Communications Pty. Ltd. www.flow.com.au
participants (2)
-
Adrian van den Dries -
Martin Gebert