Jump to: navigation, search

Other languages:
English • ‎日本語
Uploads: $wgMaxUploadSize
Maximum size of uploaded files (in bytes)
Introduced in version: 1.8.0 (r16159)
Removed in version: still in use
Allowed values: integer or array (see below)
Default value: 1024*1024*100 (100MB)
Other settings: Alphabetical | By function


This setting allows you to place a maximum size on each file that can be uploaded to your wiki.

The value(s) you specify refer to the maximum size, in bytes, of a single file upload (not the total of all uploaded files). The limit is applied at the time of upload, so lowering this value at a later date won't remove existing files that are now 'too large'. This limit only applies to chunked uploads and uploads without separate chunks might have a lower upload limit based on the PHP setting.

There are 1024 bytes in a kilobyte, and 1024 kilobytes in a megabyte, so 1024 * 1024 * 100 = 100 megabytes.

Note Note: The limits for file uploads are controlled by PHP configuration directives. To change the limits for file uploads, you need to modify php.ini, see upload_max_filesize and post_max_size PHP configuration options as well as Manual:Configuring file uploads for details. Note that whichever one of these php.ini variables is smallest will be the limiter. By default, PHP does not allow uploaded files to be more than 2 megabytes.

Specifying an integer[edit]

This limits the maximum size of uploaded files, in bytes, regardless of how they are uploaded.

$wgMaxUploadSize = 20000000;

Specifying an array[edit]

If you would like different maximum sizes for file uploads and upload-by-URL, you can set this variable to an array. For example:

$wgMaxUploadSize = array(
    '*' => 1024 * 1024 * 100, // 100 MB
    'url' => 1024 * 1024 * 2, // 2 MB

This example will set the maximum for all uploads to 100 MB, except for upload-by-URL, which will have a maximum of 2 MB.

To enable upload-by-URL, see $wgAllowCopyUploads.

MediaWiki version: 1.17

Note Note: This option has no effect on the normal upload feature for MediaWiki 1.17 and lower! If you've enabled $wgAllowCopyUploadsManual:$wgAllowCopyUploads, this setting does limit the size of files copied from a remote URL as expected. When uploading files from your local machine, this setting has no effect (for at least versions 1.9.3 through 1.12).

See also[edit]