Mobile app version of vmapp.org
Login or Join
Bryan171

: Ask for more custom fields when uploading a file in MediaWiki? Is there any way that I can ask users for more details about the file they upload into the wiki and show it in a page where

@Bryan171

Posted in: #Mediawiki #Uploading

Is there any way that I can ask users for more details about the file they upload into the wiki and show it in a page where the file is used?

My wiki allows users to upload photos and books of old times that helps in digitizing a country's past. By default the MediaWiki file upload option has a description text box and not anything else. But I, as an admin, could add some custom fields like author and archived date to the file upload page so that the file they upload will have some meaningful fields?

I couldn't find any extension to do so. Is there any way that I can achieve this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

1 Comments

Sorted by latest first Latest Oldest Best

 

@Rivera981

I could not find an extension either, but Wikimedia Commons uses an upload form similar to what you describe. You can see it at Special:Upload if you have an account (see the screenshot below if you don't).

That uses UploadForm.js, which is most likely far too complex for your purpose, although you may wish to adapt it.

A simpler way to do that is to do what some wikis such as Wikipedia do: make a template like {{Information}} that has parameters for the values you want, like author and archived date. The template should be invoked by writing something like this, where you fill in the appropriate values after the equals sign.

{{Information
|author =
|archived_date =
|any_other_fields_you_want =
}}


To add that automatically to the description box, add that value (replace newlines with %0A and spaces with +) to the wpUploadDescription parameter at the end of the URL, like this: yourwiki.com/wiki/Special:Upload?wpUploadDescription={{Information%0A+ author+=+%0A+|archived_date+=+%0A}}. You can add the link to your wiki's MediaWiki:Uploadtext, which will be shown at the top of the upload page, to prompt users to automatically fill the description box.

Edit: I thought of a different way to do this. It is not as pretty but is much easier and doesn't require any templates. Just write placeholder text in wiki markup that users can add relevant information to, like this

* '''Author:'''
* '''Archived date:'''
* etc.


When filled out, this would display a simple list on the file description page:



Author: John Smith
Archived date: January 1, 2015



Then follow the rest of the instructions above: take the wiki markup source, again replacing line breaks with %0A and spaces with +, and add it to the end of the URL as above: yourwiki.com/wiki/Special:Upload?wpUploadDescription=*+'''Author:'''+%0A*+'''Archived date:'''+. Prominently add that link to MediaWiki:Uploadtext, so users can click it to automatically fill the box with the fields you want.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme