MediaWiki API 帮助

这是自动生成的MediaWiki API文档页面。

文档和例子:-{R|https://www.mediawiki.org/wiki/API:Main_page/zh}-

action=upload

main | upload
  • 此模块需要读取权限。
  • 此模块需要写入权限。
  • 此模块只允许POST请求。
  • 来源:MediaWiki
  • 许可协议:GPL-2.0+

上传一个文件,或获取正在等待中的上传的状态。

可以使用的几种方法:

  • 直接上传文件内容,使用file参数。
  • 成批上传文件,使用filesizechunkoffset参数。
  • 有MediaWiki服务器从URL检索一个文件,使用url参数。
  • Complete an earlier upload that failed due to warnings, using the filekey parameter.

Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when sending the file.

参数:
filename

目标文件名。

comment

上传注释。如果没有指定text,那么它也被用于新文件的初始页面文本。

默认:(空)
text

Initial page text for new files.

watch
不推荐使用。

监视页面。

类型:布尔值(详细信息
watchlist

无条件地将页面加入至当前用户的监视列表或将其移除,使用设置或不更改监视。

以下值中的一个:watch、preferences、nochange
默认:preferences
ignorewarnings

忽略任何警告。

类型:布尔值(详细信息
file

文件内容。

必须被公布为使用multipart/form-data的一次文件上传。
url

要检索文件来源的URL。

filekey

Key that identifies a previous upload that was stashed temporarily.

sessionkey
不推荐使用。

Same as filekey, maintained for backward compatibility.

stash

如果设置,服务器将临时藏匿文件而不是加入存储库。

类型:布尔值(详细信息
filesize

全部上传的文件大小。

值必须介于0和104,857,600之间。
类型:整数
offset

块的偏移量(字节)。

值必须不少于0。
类型:整数
chunk

大块内容。

必须被公布为使用multipart/form-data的一次文件上传。
async

Make potentially large file operations asynchronous when possible.

类型:布尔值(详细信息
asyncdownload

Make fetching a URL asynchronous.

类型:布尔值(详细信息
leavemessage

如果asyncdownload被使用,当完成时,在用户讨论页留下一条消息。

类型:布尔值(详细信息
statuskey

Fetch the upload status for this file key (upload by URL).

checkstatus

Only fetch the upload status for the given file key.

类型:布尔值(详细信息
token

action=query&meta=tokens取回的“csrf”令牌

这个参数是必须的。