Skip to main content

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

OptionTypeDefaultDescription
waitForbooleantrueWait for the file input to appear
timeoutnumber10000How long to wait (ms)
iframestring | string[]Look inside an iframe
showClickbooleantrueShow 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.

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

CategoryExtensions
Imagesjpg, jpeg, png, gif, webp, svg, bmp, ico, tiff
Documentspdf, doc, docx, xls, xlsx, ppt, pptx, txt, csv, rtf
Audiomp3, wav, ogg, flac, aac, m4a
Videomp4, webm, mov, avi, mkv
Archiveszip, rar, 7z, tar, gz
Webjson, xml, html, css