Charlie Harvey

Stop MediaWiki thinking that a .ppt is a .doc

New Internationalist, along with teacher friends Linda Ruas and John Shepheard runs an Easier English wiki, which provides simplified versions of many of the stories from New Internationalist magazine. We are just running MediaWiki, nothing fancy. A few weeks ago after upgrading MediaWiki we hit a problem when uploading powerpoint files. We started seeing this when a user attempted to upload a powerpoint *".doc"* is not a permitted file type. Permitted file types are png, gif, jpg, jpeg, pdf, tiff, svg, odt, ods, odp, odg, ppt, pptx.

Diff of mediawiki mime.types config

At first I assumed it must be user error. But I tried it myself and sure enough got the same problem. Digging round in the documentation and forums didn’t help, so I had to work out how the code was determining which mimetype to use. Sure enough there is a file called includes/mime.types which made reference to ppt next to application/msword. I changed it to read application/vnd.msoffice and that fixed the problem. You can see the change in the screenshot.

Then we hit another problem, a new and exciting error message The file has no extension (like ".jpg")This turned out to be simply a question of making sure that the destination file field was either left blank or populated with a filename that had the right extension.


Comments

  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.