Files and file uploads: $wgProhibitedFileExtensions
Files with these extensions will never be allowed as uploads.
Introduced in version:1.37.0 (Gerrit change 680806; git #4dae3b1a)
Removed in version:still in use
Allowed values:(array)
Default value:(see below)

Details

Files with these extensions will never be allowed as uploads.

$wgProhibitedFileExtensions overrides $wgFileExtensions, so you must remove an extension from the blacklist before you can upload files that have it. For instance, to allow users to upload executables, add this to LocalSettings.php:

$wgFileExtensions[] = 'exe';
$wgProhibitedFileExtensions = array_diff(
    $wgProhibitedFileExtensions,
    [ 'exe' ] 
);
$wgMimeTypeExclusions = array_diff(
    $wgMimeTypeExclusions, 
    [ 'application/x-msdownload' ]
);

This configuration parameter used previously was wgFileBlacklist.

Default values

MediaWiki version:
1.37
/**
 * Files with these extensions will never be allowed as uploads.
 * An array of file extensions to blacklist. You should append to this array
 * if you want to blacklist additional files.
 */
$wgProhibitedFileExtensions = [
	# <translate nowrap><!--T:10--> HTML may contain cookie-stealing JavaScript and web bugs</translate>
	'html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'xhtml', 'xht',
	# <translate nowrap><!--T:11--> PHP scripts may execute arbitrary code on the server</translate>
	'php', 'phtml', 'php3', 'php4', 'php5', 'phps', 'phar',
	# <translate nowrap><!--T:12--> Other types that may be interpreted by some servers</translate>
	'shtml', 'jhtml', 'pl', 'py', 'cgi',
	# <translate nowrap><!--T:13--> May contain harmful executables for Windows victims</translate>
	'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl'
];

See also

  • Manual:$wgFileExtensions
  • Manual:$wgMimeTypeBlacklist
  • Manual:MIME type detection
  • The filename-prefix-blacklist system message defines prohibited prefixes, to avoid non-descriptive (usually camera-generated) filenames.
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.