MediaWiki API ヘルプ
このページは自動生成された MediaWiki API の説明文書ページです。
説明文書と例: https://www.mediawiki.org/wiki/API
action=upload
- このモジュールは読み取りの権限を必要とします。
 - このモジュールは書き込みの権限を必要とします。
 - このモジュールは POST リクエストのみを受け付けます。
 - ソース: MediaWiki
 - ライセンス: GPL-2.0-or-later
 
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 が指定されていない場合、初期ページテキストとしても使用されます。
- 既定値: (空)
 - tags
 Change tags to apply to the upload log entry and file page revision.
- 値 (|もしくは別の文字列で区切る):
 - text
 新しいファイルの初期ページテキスト。
- watch
 - 廃止予定です。
 このページをウォッチする。
- Type: boolean (details)
 - watchlist
 Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
- 値 (次の値のいずれか1つ): watch、preferences、nochange
 - 既定値: preferences
 - ignorewarnings
 あらゆる警告を無視する。
- Type: boolean (details)
 - file
 File contents.
- 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
 If set, the server will stash the file temporarily instead of adding it to the repository.
- Type: boolean (details)
 - filesize
 Filesize of entire upload.
- 値は 0 以上 104,857,600 以下にしてください。
 - Type: integer
 - offset
 Offset of chunk in bytes.
- 値は 0 以上にしてください。
 - Type: integer
 - chunk
 Chunk contents.
- multipart/form-data 形式でファイルをアップロードしてください。
 - async
 Make potentially large file operations asynchronous when possible.
- Type: boolean (details)
 - checkstatus
 Only fetch the upload status for the given file key.
- Type: boolean (details)
 - token
 action=query&meta=tokens から取得した「csrf」トークン
- このパラメーターは必須です。
 
- Upload from a URL.
 - api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png&token=123ABC [サンドボックスで開く]
 - Complete an upload that failed due to warnings.
 - api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1&token=123ABC [サンドボックスで開く]