---
title: "Attach a file to an upload control"
method: POST
path: "/tabs/{tabId}/upload"
tags: ["Interaction"]
---

# Attach a file to an upload control

`POST /tabs/{tabId}/upload`

Attaches files from the configured upload directory without going through the native OS file dialog. Set CAMOFOX_UPLOADS_DIR to a directory that contains the files (default: ~/.camofox/uploads). Two strategies are tried in order: (1) if an <input type="file"> is already present, call Playwright setInputFiles on it directly (works for hidden inputs); (2) otherwise arm a filechooser listener, activate the trigger element (ref or selector) via keyboard (focus + Enter) then a forced click as fallback, and call setFiles on the resulting chooser. Each path must be an absolute path that resolves inside the configured upload directory.

## Path parameters

- `tabId` string, required

## Request body

- object
  - `userId` string, required
  - `path` union, required — Absolute path, or array of paths, that resolves within CAMOFOX_UPLOADS_DIR.
    - string
    - string[]
  - `ref` string — Trigger element ref (e.g. e36). Optional when an input[type=file] already exists.
  - `selector` string — Trigger element CSS/Playwright selector. Optional when an input[type=file] already exists.
  - `timeout` integer — Overall budget in ms to wait for an upload UI (in-app panel input or native file chooser) to appear after the trigger is activated. Ignored values (non-numeric or <= 0) fall back to the default.

## Response `200`

File(s) attached.

## Other responses

- `400` — Bad request (missing path/userId; non-regular file; or a path that is missing or outside the configured upload directory).
- `404` — Tab not found.

## Changes

- **2026-08-02** `4d6dcf9124ec` — 1 info
  - endpoint added
- **2026-07-30** `2e41517135ab` — 1 breaking
  - api path removed without deprecation
- **2026-07-20** `2221ef655d89` — 1 info
  - added the new optional request property `timeout`
- **2026-07-20** `830149800648` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/jo-inc/apis/camofox-browser/changes/tabs/:tabId/upload/post.md)

---

[API](https://skmtc.dev/jo-inc/apis/camofox-browser.md) · [All operations](https://skmtc.dev/jo-inc/apis/camofox-browser/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/jo-inc/camofox-browser/revisions/d007e73dad3d/schema)
