Reputation: 855
I am running a private MediaWiki version 1.35.1 on Ubuntu Mate. I added a new file extension, 'cev'
, to my LocalSettings.php
but when I try to upload a file it gives me this message:
So, I went to this page and down under Mime Type validation it says there are 2 files in the Mediawiki includes
folder that can be customized to allow/ignore that error. Well, a "broken link" note on that page seems to indicate that the file MimeMap.php
under /includes/libs/mime
is the one to modify.
So, how do i modify MimeMap.php
so it either ignores .CEV
files or otherwise accepts them without the error message?
Upvotes: 4
Views: 378
Reputation: 10269
To support extra mime types for uploads on your wiki, you can use the MimeMagicInit hook since MediaWiki 1.24.
For example, to recognise .md
files as text/plain
for Markdown:
// Recognise the extension
$wgHooks['MimeMagicInit'][] = function ( MimeAnalyzer $mime ) {
$mime->addExtraTypes( 'text/plain md' );
};
// Allow it for new uploads
$wgFileExtensions[] = 'md';
I've also updated the MIME type detection page on mediawiki.org with this, and more information.
Upvotes: 3
Reputation: 15769
Did you already try https://www.mediawiki.org/wiki/Topic:Ps6zng4e6b00rsor
$wgVerifyMimeType = false;
$wgStrictFileExtensions = false;
$wgCheckFileExtensions = false;
There is also a strange workaround for some file types:
$wgAllowJavaUploads = true; // Solves problem with Office 2007 and newer files (docx, xlsx, etc.)
https://www.mediawiki.org/wiki/Manual:$wgAllowJavaUploads
seems to help in some cases.
Upvotes: 1