Missing File Types In Framework/utils/mimetypes.php

Users of our web app have reported problems downloading a few file types, including iCals (.ics) in Firefox, and Office 2007 documents (e.g., .docx) in IE 8 and older. It turns out this was because some file formats are not listed in framework/utils/mimeTypes.php.

We are using CHttpRequest::sendFile() and CHttpRequest::xSendFile(), which call CFileHelper::getMimeTypeByExtension() to get the content type to tell the browser. That method uses the list of file types in framework/utils/mimeTypes.php. But .ics, .docx, .xlsx, and .pptx are not listed in that file. These are very common file formats, and I’m surprised they’re not listed. (Office 97-2003 formats like .doc and .xls ARE included, but not the 2007 formats.) I had to add them myself to get the downloads to work.

Suggest adding the following entries to the file:


// icalendar

'ics'=>'text/calendar',


// Office 2007 (from MSDN website)

'docm'=>'application/vnd.ms-word.document.macroEnabled.12',

'docx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.document',

'dotm'=>'application/vnd.ms-word.template.macroEnabled.12',

'dotx'=>'application/vnd.openxmlformats-officedocument.wordprocessingml.template',

'ppsm'=>'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',

'ppsx'=>'application/vnd.openxmlformats-officedocument.presentationml.slideshow',

'pptm'=>'application/vnd.ms-powerpoint.presentation.macroEnabled.12',

'pptx'=>'application/vnd.openxmlformats-officedocument.presentationml.presentation',

'xlsb'=>'application/vnd.ms-excel.sheet.binary.macroEnabled.12',

'xlsm'=>'application/vnd.ms-excel.sheet.macroEnabled.12',

'xlsx'=>'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',

'xps'=>'application/vnd.ms-xpsdocument',