Skip to content

File upload issues in Cloud Browser Use (manual & Python SDK v2): Uploaded files not accessible/attached to file inputs #11

@mrunal-crest

Description

@mrunal-crest

I’m encountering a persistent issue related to file uploads when using Browser Use, both via the manual chat interface and with the new Python SDK (API v2).

Issue Summary

  • In a Browser Use session running in the cloud, I follow the approach of directly attaching uploaded files to the file input element on the target website (e.g., xyz.com), rather than clicking the file picker button (since file pickers aren’t available in the cloud environment).
  • When I attempt to upload a file (e.g., an image), the file appears attached to the input field, but the upload does not complete on the website. Instead, I see an error page such as:
    "Your file couldn't be accessed. It may have been moved, edited, or deleted. ERR_FILE_NOT_FOUND"
Image

What I Have Tried

  • Manual browser use session:
    • Uploaded an image file directly into Browser Use chat (file appears in the environment).
    • Attached this file directly to the file input on xyz.com.
    • Upon attempting to upload, the error above appears and the upload fails.
  • Automation/API usage:
    • Previously, I was using API v1, where I generated a presigned URL, uploaded the file, then used run_task to attach and upload the file. This worked as expected (2-3 months ago; Facebook uploads succeeded).
    • Recently, with Python SDK (API v2), I migrated my workflow.
      • File uploads via presigned URL and create_task seem to succeed (the file appears accessible in the Browser Use environment).
      • However, when I attach the same file to the input element and attempt to upload it on the site, I encounter the same error (ERR_FILE_NOT_FOUND).
      • I have also attempted the complete upload process manually in a Browser Use session (without API), but the outcome is the same.

Troubleshooting & Observations

  • The issue occurs regardless of whether I use the API or the manual chat session in Browser Use.
  • This indicates the problem may not be exclusively due to my v2 implementation—something may have changed in how file uploads are managed in the current environment.
  • The permissions or availability of the uploaded files might be different from before, or something in the storage/access mechanism has changed.

Request

  • Could you please advise on what might be causing this error? Is there a change to how files should be attached or handled with the latest SDK/Browser Use update?
  • Are there any steps or required permissions to ensure uploaded files are accessible to the file input field on third-party websites from within the cloud browser?
import time
import os
import requests
from browser_use_sdk import BrowserUse, APIError

client = BrowserUse(api_key='APIKEY')

FILE_NAME = "test.png"
FILE_PATH = "path-to-imagedir/" + FILE_NAME
CONTENT_TYPE = "image/png"

def upload_file(file_path: str, content_type: str):
    file_name = os.path.basename(file_path)
    file_size = os.path.getsize(file_path)

    upload = client.users.me.files.create_presigned_url(
        file_name=file_name,
        content_type=content_type,
        size_bytes=file_size,
    )

    upload_url = upload.url
    fields = upload.fields

    with open(file_path, "rb") as f:
        files = {"file": (file_name, f, content_type)}
        response = requests.post(upload_url, data=fields, files=files)

    if response.status_code != 201:
        print(f"[ERROR] Upload failed: {response.status_code} {response.text}")
        raise Exception(f"Upload failed: {response.status_code}")

    print(f"[SUCCESS] File uploaded: {file_name}")
    print(f"file details: {upload}")
    return upload.file_name

def run_task(file_name: str = None):
    task_prompt = (
        "Go to https://tmpfiles.org/ \n"
        f"attach the file named {file_name} to the file field input element which asks to choose file. Do not click on the button.\n"
        "Once the file is properly attached, click on the upload button to generate the URL for the hosted image"
    )

    try:
        response = client.tasks.create(
            task=task_prompt,
            included_file_names=[file_name] if file_name else [],
            agent_settings={"llm": "gemini-2.5-pro"}
        )
        print(f"[INFO] Task created: {response.id}")
        print(f"[INFO] Task created session id: {response.session_id}")
        print(f"Whole Response: {response}")
        return response.id
    except APIError as e:
        print(f"[ERROR] Could not create task: {e}")
        return None

def get_task_status(task_id: str):
    print(f"[INFO] Fetching task status for task_id: {task_id}")
    task_view = client.tasks.retrieve(task_id)

    print("[TASK STATUS RESPONSE]")
    print(f"Status: {task_view.status}")
    print(f"Output: {task_view}")
    return True

if __name__ == "__main__":
    uploaded_file = upload_file(FILE_PATH, CONTENT_TYPE)
    task_id = run_task(file_name=uploaded_file)

    if task_id:
        time.sleep(3)
        get_task_status(task_id)
    else:
        print("[ERROR] Task not created.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions