PreloadFileDescription is a script that allows you to specify custom text (ex. template code) that will be preloaded when uploading files via:

It also has few other useful features:

  • Support for multiple custom text templates selectable via a dropdown menu (like licenses)
  • Ability to select specific license as default



This script can support a single preloaded text template without a dropdown menu or multiple templates. Regardless of the mode you need to import the script.

Remember to specify configuration above importArticles.

Single template

You can specify text to preload as a value of PFD_template variable. Use \n to add line-break in the code.

PFD_template = '{{example info template\n| Parameter 1 = \n| Parameter 2 = \n}}';

Multiple templates

If you want to add ability to select the text that is preloaded from few different options that use different template or have additional categories.

In this case PFD_templates is a list that contains objects with template properties or strings that will generate group names inside the dropdown menu.

The first template on the list will be preloaded at the start.

PFD_templates = [
        label:   'Default template',
        desc:    '{{File\n| Description = \n| Date = \n| Source = \n| Author = \n| Other versions = \n}}',
    'Group header',
        label:   'Icon',
        desc:    '{{File\n| Description = \n| Date = \n| Source = \n| Author = \n| Other versions = \n}}\n',
        label:   'Portrait',
        desc:    '{{File\n| Description = \n| Date = \n| Source = \n| Author = \n| Other versions = \n}}\n',


There are few additional variables that allow to modify behavior.

  • PFD_language – by default script will display messages in language user has set (and fallback to English if it's not present – More in section: #i18n). You can force script to display text in specific language by providing a language code. Example:
PFD_language = 'en';
  • PFD_messages – override messages with custom content – More in section: #i18n. Example:
PFD_messages = {
    'en': {
        'template-change-notice': 'If you change the template, your description\'s gonna have a bad time.',
  • PFD_license – you can specify license template to be selected by default. Put template name (first part of the entry from Mediawiki:Licenses) as a value. (case sensitive) Example:
PFD_license = 'Fairuse';
  • PFD_requireLicense – when set to true script will disable file upload until proper (non-empty) license is specified. Example:
PFD_requireLicense = true;
  • PFD_discourageEditorFileUpload – when set to true script will display a short notice when using media uploader from inside the editor (right rail). Example:
PFD_discourageEditorFileUpload = true;

Template entry object

The object with info about the template also has two optional properties:

  • altdesc – allows you to specify alternative version of the same template. It'll add two buttons below the description area that allow to switch between the two. Using this method rather than specifying a different template is good for keeping the list compact and having more options. Taking Polish League of Legends Wiki as an example: some templates have an alternative version which include code that automatically fills some parameters if the file has a proper name – allowing uploading multiple files without the need to fill the description separately. (long story short: I needed it so I implemented it ^^)
  • license – script will automatically select specified license when this template is selected (and revert to previously selected one when changed back)

Example code with all properties specified:

        label:   'Label',
        desc:    '{{Some template}}',
        altdesc: '{{Some template|with some slight changes}}',
        license: 'Fairuse',
        tip: 'Explanation template',


This script doesn't have that much messages, but still if you would like for it to support your language drop a translated code below on the talk page (or add it to the code if you're confident you won't break it ;)). Thanks

    'en': {
                'alternative-version': 'Alternative',
                'basic-version': 'Basic',
                'multiple-versions': 'This template is available in two versions:',
                'template-change-notice': 'Changing the template will overwrite current description.',
                'confirm-overwrite': 'Description has been modified.\nDo you want to overwrite it with a new template?',
                'discourage-editor-file-upload': 'This wiki encourages usage of <a href="/wiki/Special:Upload">Special:Upload</a> for uploading files.',
                'discourage-continue': 'Continue',
                'disabled-submit': 'Choose a license in order to upload a file',

You can also add a language, override all or some of the messages locally by specifying them in the PFD_messages variable.

Text above can be found here (edit)
Community content is available under CC-BY-SA unless otherwise noted.