Topic on Project:Support desk

Can't upload a Powerpoint file due to extension mismatch?

6
106.132.203.73 (talkcontribs)

Hello I am trying to upload a powerpoint to my wiki. The powerpoint has the file type extension .ppt. But, I keep getting this error message: File extension ".ppt" does not match the detected MIME type of the file (application/zip).

Please help me fix this issue. I feel like uploading a presentation file should be simple, but I can't seem to fix this easily.

Bawolff (talkcontribs)

are you sure the extension isnt supposed to be pptx? Try renaming the file to pptx before upload

106.132.212.13 (talkcontribs)

The file was originally a pptm. The site I am uploading to only accepts .ppt, so I used Powerpoint Export to change the file to .ppt and then tried to upload it. As I said above, it still didn't work. I decided to create a blank .ppt file and copy over the slides, and the wiki let me upload this.

Thank you for trying to help! I wish I understood what was wrong with the converted file, but as long as I can share the info, it is fine.

Bawolff (talkcontribs)

Based on your description, it sounds like when you tried to convert it from pptm -> ppt, it only renamed it, and didn't actually convert it. MediaWiki detected it wasn't actually a ppt file so rejected it (pptm & pptx are zip based formats, which is probably why MW is saying it is application/zip. ppt is a much older format, and is not based on zip)

Seppl2013 (talkcontribs)

The bug is in that this not a warning but a show stopper. A user with sufficient rights should be able to upload things no matter what the detection mechanisms say.

204.75.126.26 (talkcontribs)

Hi Bawolff,

I ran into a similar issue. My Powerpoint is pptx and as you pointed out it's zip based format. It won't let me upload the pptx file. The error is: File extension ".pptx" does not match the detected MIME type of the file (application/zip).

When I disabled MIME type check ($wgVerifyMimeType = false;), the file is uploaded and identified MIME type as application/vnd.openxmlformats-officedocument.presentationml.presentation

However, we can't disabled MIME type since there's a security risk by doing so.

Per Mediawiki documentation page: Manual:MIME type detection

I can use this $wgMimeDetectorCommand = "file -bi"; to have the OS handles the MIME type.

But for some reason that configuration doesn't do anything. I am not sure if I need to do something else for that to take effect.

Before and after configure $wgMimeDetectorCommand = "file -bi";

I always see the same in the debug log:

[Mime] MimeAnalyzer::doGuessMimeType: analyzing head and tail of /tmp/phpBHWM00 for magic numbers.

[Mime] MimeAnalyzer::doGuessMimeType: ZIP signature present in /tmp/phpBHWM00

[Mime] MimeAnalyzer::detectZipType: unable to identify type of ZIP archive

[Mime] MimeAnalyzer::guessMimeType: guessed mime type of /tmp/phpBHWM00: application/zip

[Mime] MimeAnalyzer::improveTypeFromExtension: improved mime type for .pptx: application/zip

MediaHandlerFactory::getHandler: no handler found for application/zip.

mime: <application/zip> extension: <pptx>

UploadBase::detectScript: checking for embedded scripts and HTML stuff

UploadBase::detectScript: no scripts found

UploadBase::detectVirus: virus scanner disabled

[Mime] MimeAnalyzer::doGuessMimeType: analyzing head and tail of /tmp/phpBHWM00 for magic numbers.

[Mime] MimeAnalyzer::doGuessMimeType: ZIP signature present in /tmp/phpBHWM00

[Mime] MimeAnalyzer::detectZipType: unable to identify type of ZIP archive

[Mime] MimeAnalyzer::guessMimeType: guessed mime type of /tmp/phpBHWM00: application/zip

[Mime] MimeAnalyzer::improveTypeFromExtension: improved mime type for .pptx: application/zip

UploadBase::verifyExtension: mime type application/zip mismatches file extension pptx, rejecting file


Anyone has any success to use this configuration: $wgMimeDetectorCommand = "file -bi"; ?


Thanks,


Thai N.

Reply to "Can't upload a Powerpoint file due to extension mismatch?"