Skip to content

Function: fileToInput()

ts
function fileToInput(
   ctx: Context, 
   file: SdkFile, 
selector: string): Promise<void>;

Defined in: src/file/offerFile.tsx:136

Parameters

ParameterTypeDescription
ctxContextThe Matterway SDK context.
fileSdkFileThe SdkFile object containing the file data and metadata to be attached.
selectorstringThe 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);

Matterway Assistant SDK Documentation