Appearance
Function: fileToInput()
ts
function fileToInput(
ctx: Context,
file: SdkFile,
selector: string): Promise<void>;Defined in: src/file/offerFile.tsx:136
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The Matterway SDK context. |
file | SdkFile | The SdkFile object containing the file data and metadata to be attached. |
selector | string | The selector for the input element on the page. |
Returns
Promise<void>
Promise of void
Deprecated
Attaches a file to an input element on a web page, using the Matterway SDK context to execute the attachment process within the page.
Example
ts
const file = { name: 'example.txt', data: 'SGVsbG8gV29ybGQh', type: 'text/plain' };
const selector = 'input[type="file"]';
await fileToInput(context, file, selector);