|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-05-13 20:12 UTC] matt at kanchi dot org
Description:
------------
Certain Office files do not return an accurate MIME content type with mime_content_type. Excel and Powerpoint, for example, return an application/msword type, while Access returns text/plain. Images, text, and Word files return correctly. These files were generated in Office 2002 for Windows.
Configuration options:
--with-mime-magic
From php.ini:
mime_magic
mime_magic support => enabled
Directive => Local Value => Master Value
mime_magic.magicfile => /usr/share/file/magic.mime => /usr/share/file/magic.mime
Reproduce code:
---------------
mime_content_type("/some/path/to/xls-file");
mime_content_type("/some/path/to/ppt-file");
mime_content_type("/some/path/to/mdb-file");
Expected result:
----------------
application/msexcel
application/mspowerpoint
application/msaccess
Or some variation (vnd, x-, etc.).
Actual result:
--------------
application/msword
application/msword
text/plain
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 07:00:02 2025 UTC |
Do you mean mime_content_type("file /path/to/file")? If so, that returns the error, "mime_magic: invalid mode 0156130."