Skip to main content

File Upload

Upload files to <input type="file"> elements using remote URLs.

How File Upload Works

  1. You include files in your API request (base64 or multipart)
  2. The server uploads them to secure cloud storage
  3. The server passes the file URLs to the extension in the task payload
  4. The extension fetches the files and injects them into file inputs

uploadFile

Upload files to a file input element.

Value: [selector, files]

{
"uploadFile": [
"input[type=file]",
[{ "url": "https://files.browserworker.app/uploads/...", "fileName": "photo.jpg" }]
]
}

File Object Properties

PropertyTypeRequiredDescription
urlstringYesURL to fetch the file from
fileNamestringNoOverride the file name
mimeTypestringNoOverride the MIME type

Options

OptionTypeDefaultDescription
waitForbooleantrueWait for the file input element
timeoutnumber10000Max wait time
showClickbooleantrueShow visual feedback
iframestring | string[]Target inside iframe

Sending Files in the API Request

JSON Body (Base64)

{
"actions": [
{ "openNewTab": "https://example.com/upload" },
{ "uploadFile": ["input[type=file]", [{ "url": "$file0" }]] },
{ "click": "button[type=submit]" }
],
"files": [
{
"name": "document.pdf",
"data": "JVBERi0xLjQ...",
"contentType": "application/pdf"
}
]
}

The uploaded file URL is available as $file0, $file1, etc.

Multipart Form-Data (cURL)

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]",[{"url":"$file0"}]]},{"click":"button[type=submit]"}]}' \
-F 'files=@/path/to/document.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

Example: Upload an Image

{
"actions": [
{ "openNewTab": "https://example.com/profile" },
{ "uploadFile": [
"#avatar-input",
[{ "url": "$file0", "fileName": "avatar.png", "mimeType": "image/png" }]
]
},
{ "click": "#save-profile" },
{ "waitForElement": ".success-toast" },
{ "screenshot": "viewport" }
],
"files": [
{ "name": "avatar.png", "data": "iVBORw0KGgo...", "contentType": "image/png" }
]
}