# Issue uploading files using k6-browser page.setInputFiles

**URL:** <https://community.grafana.com/t/issue-uploading-files-using-k6-browser-page-setinputfiles/160392>\
**Category:** k6-browser\
**Created:** [December 19, 2025, 7:25pm UTC](https://community.grafana.com/t/issue-uploading-files-using-k6-browser-page-setinputfiles/160392 "2025-12-19T19:25:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerrydoan](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kerrydoan](https://community.grafana.com/u/kerrydoan)\
**Post date:** [December 19, 2025, 7:25pm UTC](https://community.grafana.com/t/issue-uploading-files-using-k6-browser-page-setinputfiles/160392/1 "2025-12-19T19:25:05Z")

</div>

Hello!

I am opening the file I want to upload in the init

```typescript
const fileForUpload = open('./files/skipped/meta-001.pdf', 'b');

```

My code with use of `page.setInputFiles()`

```typescript
    await page.setInputFiles('input[class="dz-hidden-input"]', {
        name: 'meta-001.pdf',
        mimeType: 'application/octet-stream',
        buffer: fileForUpload,
    });

```

When the code runs I get the following error when the `page.setInputFiles()` step runs

```bash
INFO[0022] Error performing ui interactions: setting input files on "input[class=\"dz-hidden-input\"]": InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
    at __xk6_browser_evaluation_script__ :2056:39
    at Array.map (<anonymous>)
    at InjectedScript.setInputFiles ( __xk6_browser_evaluation_script__ :2055:30)
    at __xk6_browser_evaluation_script__ :3:20 source=console

```

I have tried looking at documentation and researching other examples but I have had no luck getting this to work.

Anyone have any ideas?

k6 version info: `k6 v1.4.2 (commit/5b725e8a6a, go1.25.4, linux/amd64)`

---

<div class="post-metadata">

**Author:** ![mstoykov](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/mstoykov/32/35309_2.png) [@mstoykov](https://community.grafana.com/u/mstoykov)\
**Post date:** [March 27, 2026, 8:52am UTC](https://community.grafana.com/t/issue-uploading-files-using-k6-browser-page-setinputfiles/160392/2 "2026-03-27T08:52:40Z")

</div>

Hi @kerrydoan, please report this as an issue in the grafana/k6 project
