Home
/
Other Applications
/
Enable and manage uploads in MediaWiki

Enable and manage uploads in MediaWiki

The first step you need to take before uploading images is to ensure the following:

  • The images directory is writable. If not – you may easily change the folder’s permissions via the File Manager tool in your Site Tools or over FTP.
  • Upload in MediaWiki is enabled. To do this, you should open the LocalSettings.php file for editing and make sure that the $wgEnableUploads is set to true as shown below:
$wgEnableUploads = true;
  • The file’s extension is allowed for upload. To confirm this, open the includes/DefaultSettings.php file for editing. Then search for the $wgFileExtensions variable. It should look like the line below:
$wgFileExtensions = [ 'png', 'gif', 'jpg', 'jpeg', 'webp' ];

If the file’s extension is not present, you can edit the file and add it manually. As an alternative, you may allow most file types to be uploaded by changing the $wgStrictFileExtensions variable to false.

$wgStrictFileExtensions = false;

You should also make sure you are logged in the MediaWiki application.

Upload Permissions

By default, all registered users can upload files. To change this, you have to modify the $wgGroupPermissions variable in includes/DefaultSettings.php. To prevent normal users from uploading files, you should set:

$wgGroupPermissions['user']['upload'] = false;

To create a special group called uploadaccess, and allow members of this group to upload files, you should set:

$wgGroupPermissions['uploadaccess']['upload'] = true;

To allow autoconfirmed (non-newbie) users to upload files, you should set:

$wgGroupPermissions['autoconfirmed']['upload'] = true;

Uploading Directly from a URL

You can allow users to directly upload files from a URL. To allow this, in includes/DefaultSettings.php you should set:

$wgAllowCopyUploads = true

To add an image to a post, you need to indicate it in your post as an image using:

[[image:test.png]]

(where test.png is the name of the image).

You can also add thumbnailed images using:

[[image:test.png|thumb|caption]]

The image can be aligned so that you can add text next to it. Here is an example of how to create a left aligned image:

[[image:test.png|left|thumb|50px|]]

 

Share This Article