Yii Framework Forum: Missing File Types In Framework/utils/mimetypes.php - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Missing File Types In Framework/utils/mimetypes.php Rate Topic: -----

#1 User is offline   Keith Dechant 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 25-April 11

Posted 29 April 2013 - 01:19 PM

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',

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users