RE: [Zope] Zope and mime types ???
You probably cannot do anything to make sure that you get this MIME type unless you map it yourself at the server.
I understand, that there must be a mapping of the file extension to the appropriate mime type. I found in the mime.types file of my Apache config that there .doc is mapped to application/msword. But why does it still depend on the fact, that word is installed on the client or not? Mime/content types do not really make sense to me that way. Am I wrong or is there a way to control this on the server machine? TIA Frank
On Sat, 6 Oct 2001, Frank Stephan wrote:
You probably cannot do anything to make sure that you get this MIME type unless you map it yourself at the server.
I understand, that there must be a mapping of the file extension to the appropriate mime type. I found in the mime.types file of my Apache config that there .doc is mapped to application/msword. But why does it still depend on the fact, that word is installed on the client or not?
Remember not all .doc files are word documents. You really need something to analyze the document and tell what kind of item it is. It is kind of a pitty that extensions where ever invented and I hope for the day when they finally die the death they deserve.
Mime/content types do not really make sense to me that way. Am I wrong or is there a way to control this on the server machine?
TIA Frank
Zope stores the mime type that the browser gave it with the uploaded file. When someone tries to download the file, Zope provides the mime type for it, regardless of its exetension (Zope doesn't know from extensions) and regardless of the one that Apache might have provided (Apache doesn't get involved, Zope's doing the work). Now if you want to hear something really wierd ... I've found that if another program on the client machine has the file open at the time you upload it to Zope (e.g. MS Word has it open because you just created it), Zope's copy of the file will get the 'application/octet-stream' type. But, if you close MS Word, then upload it again, this time it will get the correct type 'application/msword'. -- Loren
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Frank Stephan Sent: Friday, October 05, 2001 16:53 To: Mailingliste Zope Subject: RE: [Zope] Zope and mime types ???
You probably cannot do anything to make sure that you get this MIME type unless you map it yourself at the server.
I understand, that there must be a mapping of the file extension to the appropriate mime type. I found in the mime.types file of my Apache config that there .doc is mapped to application/msword. But why does it still depend on the fact, that word is installed on the client or not?
Mime/content types do not really make sense to me that way. Am I wrong or is there a way to control this on the server machine?
TIA Frank
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Now if you want to hear something really wierd ...
I've found that if another program on the client machine has the file open at the time you upload it to Zope (e.g. MS Word has it open because you just created it), Zope's copy of the file will get the 'application/octet-stream' type. But, if you close MS Word, then upload it again, this time it will get the correct type 'application/msword'.
I checked this and... yes, it's really weird. So I see no chance to create a product like DocumentLibrary using content/mime types. The only way to get the correct 'mapping' is to use the file extensions ?!? Am I right with that? Please comment. TIA Frank
So I see no chance to create a product like DocumentLibrary using content/mime types. The only way to get the correct 'mapping' is to use the file extensions ?!?
Am I right with that? Please comment.
No. I think 'kosh' in another post in this thread said right: "You really need something to analyze the document and tell what kind of item it is." Neither browser-reported mime types (which, on Windows, are based on extensions) nor extensions themselves are reliable. Extensions might be more reliable in your environment. An occasional inconsistency may or may not be a serious problem for you and your users. I just wait until someone complains about not being able to launch the right application to read a document, then I fix it manually. If an occasional inconsistency is not tolerable, you might want to write code for Zope that tries to be more precise. It might compare extension to mime-type and report inconsistencies. Or it might examine file content (good luck!) and set mime-type accordingly. If you do so, please tell us what you come up with. -- Loren
On Tue, 9 Oct 2001, Loren Stafford wrote:
So I see no chance to create a product like DocumentLibrary using content/mime types. The only way to get the correct 'mapping' is to use the file extensions ?!?
Am I right with that? Please comment.
No. I think 'kosh' in another post in this thread said right:
"You really need something to analyze the document and tell what kind of item it is."
Neither browser-reported mime types (which, on Windows, are based on extensions) nor extensions themselves are reliable. Extensions might be more reliable in your environment. An occasional inconsistency may or may not be a serious problem for you and your users. I just wait until someone complains about not being able to launch the right application to read a document, then I fix it manually.
If an occasional inconsistency is not tolerable, you might want to write code for Zope that tries to be more precise. It might compare extension to mime-type and report inconsistencies. Or it might examine file content (good luck!) and set mime-type accordingly. If you do so, please tell us what you come up with.
My problem is that I am starting to see a lot more rtf and plain text files with .doc extensions. People say they want things as word documents and if you give them something.txt or .rtf they freak out. However if you give it a .doc extension word will open it. However this seems like a good way to break various word processing programs. Extensions are a hack and they need to be completely eliminate.
[<kosh@aesaeion.com>]
My problem is that I am starting to see a lot more rtf and plain text files with .doc extensions. People say they want things as word documents and if you give them something.txt or .rtf they freak out. However if you give it a .doc extension word will open it. However this seems like a good way to break various word processing programs. Extensions are a hack and they need to be completely eliminate.
We can eliminate them the day you can interrogate a file and have it tell you what type it is. That capability is way overdue, but current file formats do not support such a capability. Until then, we need extensions. Cheers, Tom P
[Frank Stephan]
So I see no chance to create a product like DocumentLibrary using content/mime types. The only way to get the correct 'mapping' is to use the file extensions ?!?
Am I right with that? Please comment.
There is no general way. Word documents do not have to have a ".doc" extension and non-Word documents may have a ".doc" extension. The convention seems to be followed more often these days, but there's no guarantee. The only way would be to snoop the file and determine from the contents what it is. And that's not only hard, it may not always be possible. So encourage everyone to use standard file extensions, provide an override mechanism, and hope for the best. Cheers, Tom P
I forgot to mention that you can change the mime type (Content Type) of a Zope file thru the manaagement interface. It's on the Edit tab of the file object. -- Loren
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Frank Stephan Sent: Friday, October 05, 2001 16:53 To: Mailingliste Zope Subject: RE: [Zope] Zope and mime types ???
You probably cannot do anything to make sure that you get this MIME type unless you map it yourself at the server.
I understand, that there must be a mapping of the file extension to the appropriate mime type. I found in the mime.types file of my Apache config that there .doc is mapped to application/msword. But why does it still depend on the fact, that word is installed on the client or not?
Mime/content types do not really make sense to me that way. Am I wrong or is there a way to control this on the server machine?
TIA Frank
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Frank Stephan -
kosh@aesaeion.com -
Loren Stafford -
Thomas B. Passin