File Upload
Upload files into <input type="file"> elements on a page.
uploadFile
Attach one or more files to a file input by URL. The extension fetches each file and injects it via the DataTransfer API — the same way a user would drag and drop a file.
Value: [selector, url] or [selector, [url1, url2, ...]]
<input type="file" name="avatar">
[
{ "uploadFile": ["input[type=file]", "https://example.com/photo.jpg"] }
]
Returns:
{
"count": 1,
"files": [{ "name": "photo.jpg", "size": 84321, "type": "image/jpeg" }]
}
Multiple files:
[
{
"uploadFile": [
"input[type=file]",
[
"https://example.com/photo.jpg",
"https://example.com/document.pdf"
]
]
}
]
Override file name or MIME type — pass objects instead of plain URLs:
[
{
"uploadFile": [
"input[type=file]",
[{ "url": "https://example.com/file.bin", "fileName": "resume.pdf", "mimeType": "application/pdf" }]
]
}
]
Options
| Option | Type | Default | Description |
|---|---|---|---|
waitFor | boolean | true | Wait for the file input to appear |
timeout | number | 10000 | How long to wait (ms) |
iframe | string | string[] | — | Look inside an iframe |
showClick | boolean | true | Show pulsing animation on the input before uploading |
Uploading Your Own Files
Send files directly in the API request and reference them with $file:0, $file:1, etc. The file is passed through to the browser and uploaded to the target site.
Multipart (cURL) — Recommended
Sends the file as real binary — no base64 encoding overhead:
curl -X POST https://api.browserworker.app/v1/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-F 'payload={"actions":[
{"openNewTab":"https://example.com/upload"},
{"uploadFile":["input[type=file]","$file:0"]},
{"click":"button[type=submit]"}
]}' \
-F 'files=@/path/to/document.pdf'
Multiple files — add more -F files=@... entries and reference them in order:
curl -X POST https://api.browserworker.app/v1/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-F 'payload={"actions":[
{"openNewTab":"https://example.com/upload"},
{"uploadFile":["input[type=file]",["$file:0","$file:1"]]},
{"click":"button[type=submit]"}
]}' \
-F 'files=@/path/to/photo.jpg' \
-F 'files=@/path/to/document.pdf'
JSON Body (Base64)
Encode the file as base64 and include it in the request body:
{
"actions": [
{ "openNewTab": "https://example.com/upload" },
{ "uploadFile": ["input[type=file]", "$file:0"] },
{ "click": "button[type=submit]" }
],
"files": [
{
"name": "document.pdf",
"data": "JVBERi0xLjQ...",
"contentType": "application/pdf"
}
]
}
Allowed File Types
| Category | Extensions |
|---|---|
| Images | jpg, jpeg, png, gif, webp, svg, bmp, ico, tiff |
| Documents | pdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, rtf |
| Audio | mp3, wav, ogg, flac, aac, m4a |
| Video | mp4, webm, mov, avi, mkv |
| Archives | zip, rar, 7z, tar, gz |
| Web | json, xml, html, css |