File Upload
Upload files to <input type="file"> elements using remote URLs.
How File Upload Works
- You include files in your API request (base64 or multipart)
- The server uploads them to secure cloud storage
- The server passes the file URLs to the extension in the task payload
- 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
| Property | Type | Required | Description |
|---|---|---|---|
url | string | Yes | URL to fetch the file from |
fileName | string | No | Override the file name |
mimeType | string | No | Override the MIME type |
Options
| Option | Type | Default | Description |
|---|---|---|---|
waitFor | boolean | true | Wait for the file input element |
timeout | number | 10000 | Max wait time |
showClick | boolean | true | Show visual feedback |
iframe | string | 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
| 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 |
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" }
]
}