What is the correct mimetype with Apache OpenOffice files such as (* .odt, * .ods, * .odp)?

I want the * .ods and * .odt files on the website to open in openoffice when clicked, and not saved on the desktop or opened in a browser, etc. Now, obviously, it all depends on how everything is configured for each user, but what is the best MIMETYPE and other settings to achieve this particular time?

I know For documents older than * .doc this was enough:

header("Content-Type: application/msword") ;

I would like to find a solution for an open office.

+6
source share
1 answer

My /etc/mime.types says this:

  • application/vnd.oasis.opendocument.text for *.odt
  • application/vnd.oasis.opendocument.spreadsheet for *.ods
  • application/vnd.oasis.opendocument.presentation for *.odp

This makes sense because the corporate standard (vnd) developed by OASIS is used for different opendocuments formats.

If you don't want to worry about sending the correct mime types, you can use the finfo class to do this for you:

 $finfo = new finfo(FILEINFO_MIME); header('Content-Type: ' . $finfo->file('/path/to/file')); 
+15
source

All Articles