Function: uploadToDraft()
function uploadToDraft(
page,
draftItemId,
filePaths,
__namedParameters?
): Promise<string[]>;
Defined in: core/forms.ts:233
Uploads local files to a form's draft area, as the file picker's "Upload a file" does: the
upload repository's id comes from the page's file picker settings, the context from M.cfg.
A DraftUpload names the file in the area, in a subfolder when its to has one (created first).
With overwrite, a file of the same name is replaced; without it, Moodle keeps both, renaming the new one.
Returns each file's draft URL (draftfile.php/<user context>/user/draft/<item>/<name>), in order:
what an editor writes into its HTML for a file in its draft area.
Parameters
| Parameter | Type |
|---|---|
page | Page |
draftItemId | string |
filePaths | (string | DraftUpload)[] |
__namedParameters | { overwrite?: boolean; } |
__namedParameters.overwrite? | boolean |
Returns
Promise<string[]>