How to Upload Images to MediaWiki

Updated on October 4, 2022

With MediaWiki you can upload images and other files.

Each file has its own wiki page, can be embedded in other pages and has its own version history.

If you are using ProWiki MediaWiki hosting you can enable file uploads via the admin panel. Go to the Permissions tab. If you are using basic MediaWiki, see the configuration instructions further down on this page.

File upload options in the ProWiki admin panel

File uploads are disabled by default, both on ProWiki and in basic MediaWiki.

Enable MediaWiki File Uploads

You will need to edit the LocalSettings.php configuration file. This is rather technical and requires server access.

  • Start editing LocalSettings.php
  • Find $wgEnableUploads = false; and replace it with $wgEnableUploads = true;
  • If there is no such line yet, simply add $wgEnableUploads = true; to the end of the file
  • Make sure there is only one line with $wgEnableUploads
  • Save LocalSettings.php

You also need to ensure that the server has sufficient disk space, and that the webserver is configured to allow file uploads.

Disable MediaWiki File Uploads

You will need to edit the LocalSettings.php configuration file. This is rather technical and requires server access.

  • Start editing LocalSettings.php
  • Find $wgEnableUploads = true; and replace it with $wgEnableUploads = false;
  • If there is no such line yet, simply add $wgEnableUploads = false; to the end of the file
  • Make sure there is only one line with $wgEnableUploads
  • Save LocalSettings.php

MediaWiki Upload Permissions

Per default, all registered users can upload files once file uploads are enabled.

To restrict who can upload files to your wiki:

  • Start editing LocalSettings.php
  • Remove any lines with $wgGroupPermissions['XYZ']['upload'], where XYZ can be anything
  • Add $wgGroupPermissions['user']['upload'] = false; to the end of the file
  • To allow administrators (users in the sysop group) to upload, add $wgGroupPermissions['sysop']['upload'] = true; to the end of the file
  • Save LocalSettings.php