Constructor
new mw.Upload(apiconfigopt)
#
Used to represent an upload in progress on the frontend.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiconfig |
Object | mw.Api |
<optional> |
A mw.Api object (or subclass), or configuration to pass to the constructor of mw.Api. |
- Source:
Classes
- BookletLayout
- BookletLayout class for encapsulating the process of uploading a file.
- Dialog
- Class for controlling a BookletLayout.
Properties
Statestatic
#
Properties:
Name | Type | Description |
---|---|---|
NEW |
Upload not yet started |
|
WARNING |
Upload finished, but there was a warning |
|
ERROR |
Upload finished, but there was an error |
|
UPLOADING |
Upload in progress |
|
STASHED |
Upload finished, but not published, call #finishStashUpload |
|
UPLOADED |
Upload finished and published |
- Source:
Methods
finishStashUpload() → {jQuery.Promise}
#
getApi() → {jQuery.Promise.<mw.Api>}
#
getBasename(path) → {string}
#
Gets the base filename from a path name.
Parameters:
Name | Type | Description |
---|---|---|
path |
string |
- Source:
Returns:
- Type
- string
getComment() → {string}
#
Get the current value of the edit comment for the upload.
- Source:
Returns:
- Type
- string
getFile() → {HTMLInputElement|File|Blob}
#
getFilename() → {string}
#
Get the filename, to be finalized on upload.
- Source:
Returns:
- Type
- string
getImageInfo() → {Object|undefined
}
#
undefined
}
#
Get the imageinfo object for the finished upload. Only available once the upload is finished! Don't try to get it beforehand.
- Source:
Returns:
- Type
-
Object
|
undefined
getState() → {mw.Upload.State}
#
getStateDetails() → {string}
#
getText() → {string}
#
Get the text of the file page, to be created on file upload.
- Source:
Returns:
- Type
- string
getWatchlist() → {boolean}
#
Get the boolean for whether the file will be watchlisted after upload.
- Source:
Returns:
- Type
- boolean
setComment(comment)
#
Set the edit comment for the upload.
Parameters:
Name | Type | Description |
---|---|---|
comment |
string |
- Source:
setFile(file)
#
Set the file to be uploaded.
Parameters:
Name | Type | Description |
---|---|---|
file |
HTMLInputElement | File | Blob |
- Source:
setFilekey(filekey)
#
Set the stashed file to finish uploading.
Parameters:
Name | Type | Description |
---|---|---|
filekey |
string |
- Source:
setFilename(filename)
#
Set the filename, to be finalized on upload.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string |
- Source:
setFilenameFromFile()
#
Sets the filename based on the filename as it was on the upload.
- Source:
setState(state, stateDetails)
#
Sets the state and state details (if any) of the upload.
Parameters:
Name | Type | Description |
---|---|---|
state |
mw.Upload.State | |
stateDetails |
Object |
- Source:
setText(text)
#
Set the text of the file page, to be created on file upload.
Parameters:
Name | Type | Description |
---|---|---|
text |
string |
- Source:
setWatchlist(watchlist)
#
Set whether the file should be watchlisted after upload.
Parameters:
Name | Type | Description |
---|---|---|
watchlist |
boolean |
- Source: