MediaWiki API 說明
此頁為自動產生的 MediaWiki API 說明文件頁面。
說明文件與範例:https://www.mediawiki.org/wiki/API
action=upload
(main | upload)
- 此模組需要讀取權限。
- 此模組需要寫入權限。
- 此模組僅接受 POST 請求。
Upload a file, or get the status of pending uploads.
Several methods are available:
- Upload file contents directly, using the file parameter.
- Upload the file in pieces, using the filesize, chunk, and offset parameters.* Have the MediaWiki server fetch a file from a URL, using the url parameter.
- 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 to fetch the file from.
- filekey
Key that identifies a previous upload that was stashed temporarily.
- sessionkey
- 已停用。
Same as filekey, maintained for backward compatibility.
- stash
如果设置,服务器将临时藏匿文件而不是加入存储库。
- filesize
Filesize of entire upload.
- 數值必須在 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
If asyncdownload is used, leave a message on the user talk page if finished.
- 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" 密鑰。
- 此參數為必填。