Allow all file uploads in mediawiki

I wanted to allow /all/ file uploads on a mediawiki installation (debian squeeze). This included files with no extension. This was harder than I thought, as there’s no extensionless option in mediawiki, you have to hack the sourcecode.

Add the following to LocalSettings.php:

$wgStrictFileExtensions = false;
$wgCheckFileExtensions = false;

edit /etc/php5/conf.d/suhosin.ini and change:

;suhosin.upload.disallow_elf = on


suhosin.upload.disallow_elf = off

Edit: /usr/share/mediawiki/includes/specials/SpecialUpload.php comment out the following block:

                if ($finalExt == '') {
                        return self::FILETYPE_MISSING;
                } elseif ( $this->checkFileExtensionList( $ext, $wgFileBlacklist ) ||
                                ($wgCheckFileExtensions && $wgStrictFileExtensions &&
                                        !$this->checkFileExtension( $finalExt, $wgFileExtensions ) ) ) {
                        $resultDetails = array( 'finalExt' => $finalExt );
                        return self::FILETYPE_BADTYPE;

One thought on “Allow all file uploads in mediawiki

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>