I want *.ods
and *.odt
files on a website to open in openoffice when clicked, not get saved on desktop, or get opened embedded in a browser etc. Now obviously it all depends on how everything is configured for each user, but what's the best MIMETYPE and other settings to achieve just that most of the time?
I know For older *.doc
documents this was enough:
header("Content-Type: application/msword")
;
I would like solution for open office.
My /etc/mime.types
says it's:
application/vnd.oasis.opendocument.text
for *.odt
application/vnd.oasis.opendocument.spreadsheet
for *.ods
application/vnd.oasis.opendocument.presentation
for *.odp
It makes sense, as it's a corporate standard (vnd), designed by OASIS organization, used for different formats of opendocuments.
If you don't want to bother yourself about sending correct mime types, you may use finfo
class to do it for you:
$finfo = new finfo(FILEINFO_MIME);
header('Content-Type: ' . $finfo->file('/path/to/file'));