Re: Download File MimeType
Re: Download File MimeType
- Subject: Re: Download File MimeType
- From: Jonathan Rochkind <email@hidden>
- Date: Thu, 25 Mar 2004 11:52:20 -0600
At 8:54 AM -0600 3/25/04, James Cicenia wrote:
Hello -
How do people manage the mime type? Do you just parse
the suffix of a document? How does a file system tell the
browser the mimetype?
Well, it's not neccesarily the _file system_ that is telling the
browser the mime content type, so the browser can forward it with a
request. But where does the browser get this from? It depends on the
file system. Windows uses the 'extension' (ie suffix) only, as far as
I know. Mac OS9 uses the type/creator codes. OSX may use some
combination of type/creator codes (those still exist in OSX, don't
they?) and suffix. Unixes probably use the extension, but map the
extension to content type with application-specific mapping files,
instead of a universal OS mapping file that I'm betting Windows and
Mac have (although I don't really know).
How do I do it? Well, if it's a file uploaded by the browser, then
the browser will usually send along a mime type. I record this mime
type in the db with my record for the file, so I know what mime type
it is. If for some reason the browser does not send along a mime
content type (or it sends along a type that's not in my list of
recognized types---I only accept some types), then I look at the
file's dot-extension. I have a list in my db of dot-extensions and
what mime type they correspond to. So when I determine the proper
mime content type from the extension, I store that in the db, just
like if I got it from the browser. [There may be lists of
extension/mime-content-type mappings sitting around in your OS or
your webserver (apache) already; since I only support a limited set
anyway, I just created my own list in the database, rather than try
to find an existing all-encompassing one from some other source.]
--Jonathan
-James Cicenia
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.