solution for upload files to mediawiki site

I am working on a tool which automates the process of uploading files to a mediawiki site.
i.e or your local mediawiki based wiki.

Wrote the python script.
You can get it here.

But, when I run it againt my local wiki, to upload the ogg files, it is not accepting it.
throwing the error like following.

Traceback (most recent call last):
  File “”, line 96, in <module>
  File “”, line 73, in upload_file
    picture.upload(fileobj=file_object,comment=caption, ignorewarnings=True)
  File “/usr/local/lib/python2.7/dist-packages/wikitools/”, line 228, in upload
    res = req.query()
  File “/usr/local/lib/python2.7/dist-packages/wikitools/”, line 143, in query
    raise APIError(data[‘error’][‘code’], data[‘error’][‘info’])
wikitools.api.APIError: (u’filetype-banned’, u’This type of file is banned’)

it means that the ogg file format is not accepted in the mediawiki site.

How to allow the upload of the ogg files in the mediawiki site?

Add the following two lines in the file LocalSettings.php inside your mediawiki installation folder.

$wgStrictFileExtensions = False;

$wgFileExtensions = array(‘png’,’gif’,’jpg’,’jpeg’,’doc’,’xls’,’mpp’,’pdf’,’ppt’,’tiff’,’bmp’,’docx’, ‘xlsx’, ‘pptx’,’ps’,’odt’,’ods’,’odp’,’odg’, ‘ogg’);

After adding these lines, I can able to upload the ogg files to my local mediawiki site.

Thanks for Yuvaraj Pandian for getting the correct tokens to solve the issue.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s