Matterway
    Preparing search index...

    Function fileToInput

    • Attaches a file to an input element on a web page, using the Matterway SDK context to execute the attachment process within the page.

      Parameters

      • 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

      const file = { name: 'example.txt', data: 'SGVsbG8gV29ybGQh', type: 'text/plain' };
      const selector = 'input[type="file"]';
      await fileToInput(context, file, selector);