Personal tools

Help:Modifying Allowed File Types for Uploading

From StcWiki

Jump to: navigation, search
Content on this page is incomplete or invalid. If it provides instructional material, it should not be followed at this time.

July 3, 2006 post in DevForum by Destry:

Again, this information is for future admins; no need to worry while I'm at the helm, but in the event I fly off on the next rocket ship to Venus, someone will now know (besides Lou) what to do.

By default, MediaWiki allows a set number of image type files to be uploaded for documentation purposes. In fact, the entire process is described and created in MediaWiki with image terminology specifically. However, MediaWiki can be configured to accept other file types, such as .txt, .pdf, .rtf, and so forth. Lou Quillio has already configured the wiki to accept Word and PDF files (.doc, .pdf) so we really shouldn't need anymore. In any case, it's better to use the wiki for writing anyway, as much as humanly possible.

The code for the core image allowances is located in the DefaultSettings.php file (in ...includes), and looks something like this:

Code: $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ogg' );

You can never modify (add new file type extensions) to this line of code in the DefaultSettings.php file directly, as it will cause things to break.

Instead, you copy the line of code in the DefaultSettings.php file exactly, paste it into the LocalSettings.php file (located at the root of the wiki install location), and then add the file type extensions you want to the end of the array, for example:

Code: $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ogg', 'txt', 'doc', 'rtf', 'xls');

Depending on the file type you want to add, you may have to take into consideration the filetype blacklist (also located in the DefaultSettings.php file) to see if a particular file extension needs removed from the blacklist to allow it to function. However, if a file type is in this blacklist, it's for a good reason and you should just leave these files alone. Period!