Appearance
Function: mwFileFromInput()
ts
function mwFileFromInput(
ctx: Context,
selector: string,
options?: WaitForSelectorOptions): Promise<MwFile[]>;Defined in: src/file/getMwFile.tsx:407
Experimental
Return the files attached to a file input element.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selector | string | CSS selector or XPath for the file input element. |
options? | WaitForSelectorOptions | Options for waiting on the selector. |
Returns
Promise<MwFile[]>
An array of MwFile objects from the input.
Example
ts
const attachments = await mwFileFromInput(ctx, '.attachment');
const pdfs = attachments.filter(f => f.type === 'application/pdf');
const invoices = pdfs.filter(f => f.name.startsWith('invoice-'));