MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page

action=createapage-upload

(main | createapage-upload)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.
  • Source: CreateAPage
  • License: GPL-2.0-or-later

CreateAPage image upload API module

Specific parameters:
Other general parameters are available.
num

Numeric upload form identifier for when a createplate has multiple upload fields; this should be used but I think the code uses wpPostFix due to reasons that aren't clear to me (i.e. why does it not use the num param when it is defined and instead requires the parameter to be defined as wpPostFix?). Patches welcome!

This parameter is required.
Type: integer
infix

Should be used but...isn't; for some reason the upload PHP code expects you to set wpInFix instead and I wasn't able to figure out why. Patches welcome!

comment

Upload summary message; if not set, defaults to the value of MediaWiki:Createpage-uploaded-from

wpInFix

This is/should properly be named infix, but the upload class expects this name instead and I wasn't able to figure out why. Patches welcome!

wpPostFix

The upload class expects this name instead and I wasn't able to figure out why. The "proper" version of this parameter is called num. Patches welcome!

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Example:
Upload an image from an infobox in the Special:CreatePage interface using the custom CreatePageImageUploadForm PHP class; requires various values to be set in the WebRequest, such as the actual uploadable file data, so merely accessing a URL like this won't work on its own, obviously. Really, the only thing that should be using this endpoint is Special:CreatePage, and hopefully in the future we can have that use the "regular" core JS API for file uploads (patches welcome!).
api.php?action=createapage-upload&num=1&infix=All [open in sandbox]