Chapter 5. Images and Files

In the previous chapter, you learned how to create and edit pages using wikitext, but that just skimmed the surface of the kind of content you can add to a wiki page. In this chapter, you will learn how to configure MediaWiki so that files can be uploaded, as well as how to control what kinds of files can be uploaded. You will also learn how to link to images, embed images in pages, and create thumbnails, as well as how to make image galleries. The chapter concludes with a discussion of uploading different file types and how you can use this feature as a simple document management tool.

File Uploads

MediaWiki can be configured to allow users to upload files of any type. By default, this feature is used primarily to upload images, but it can also be used to upload documents in formats such as Microsoft Word, Adobe PDF, and so on. By default, file uploading is disabled, so the first step is to enable it.

Enabling Uploads

There are three steps to enabling file uploads. The first step is to make sure that PHP is configured to allow file uploads. This is set in the php.ini file:

file_uploads = On

The second step is to make sure that $wgFileUploads is set to true in LocalSettings.php:


By default, MediaWiki installs all files inside the images folder of your MediaWiki installation.

The third step is to make sure that the images directory in your MediaWiki installation is writeable by the Web server because that is where the uploaded files will reside. ...

Get Professional Wikis now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.