> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# save_file_to_s3

Downloads a file from a web page and automatically uploads it to AWS S3 storage in a single operation.

Combines [download\_file](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/functions/download_file.md) (for trigger methods) and [upload\_file\_to\_s3](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/functions/upload_file_to_s3.md)
(for S3 configuration), providing a streamlined workflow for capturing and storing files.

```python theme={null}
async def save_file_to_s3(
    page: Page,
    trigger: Trigger,
    *,
    timeout_s: int,
    configs: S3Configs | None,
    file_name_override: str | None,
    content_type: str | None,
) -> Attachment
```

## Examples

```python URL Trigger theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import save_file_to_s3, S3Configs
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    uploaded_file = await save_file_to_s3(
        page=page,
        trigger="https://intuned-docs-public-images.s3.amazonaws.com/27UP600_27UP650_ENG_US.pdf",
        configs=S3Configs(
            bucket_name='document-storage',
            region='us-east-1',
            access_key='accessKeyId',
            secret_key='SecretAccessKeyId'
        ),
        file_name_override='reports/monthly-report.pdf'
    )
    return {"file": uploaded_file}
```

```python Locator Trigger theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import save_file_to_s3
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    await page.goto("https://sandbox.intuned.dev/pdfs")
    uploaded_file = await save_file_to_s3(
        page=page,
        trigger=page.locator("xpath=//tbody/tr[1]//*[name()='svg']"),
        timeout_s=10
    )
    download_url = await uploaded_file.get_signed_url(7200)  # 2 hours
    print(f"Temporary access: {download_url}")
```

## Arguments

**page** `Page` *required*

The Playwright Page object to use for downloading

**trigger** `Trigger` *required*

The [Trigger](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/type-references/Trigger.md) method to initiate the download.

**timeout\_s** `int`

Maximum time in seconds to wait for download to start. Defaults to 5.

**configs** `S3Configs`

Optional [S3Configs](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/type-references/S3Configs.md) to customize the S3 upload.
If not provided, uses environment variables (`AWS_ACCESS_KEY_ID`,
`AWS_SECRET_ACCESS_KEY`, `AWS_REGION`, `AWS_ENDPOINT_URL`, `AWS_BUCKET`). If
environment variables aren't set, uses default Intuned S3 settings.

**file\_name\_override** `str`

Optional custom filename for the uploaded file. If not provided, uses the
original filename or generates a unique name.

**content\_type** `str`

Optional MIME type for the uploaded file (e.g., "application/pdf",
"image/png"). If None, uses the original content type.

## Returns: `Attachment`

An [Attachment](https://intunedhq.com/docs/automation-sdks/intuned-sdk/python/helpers/type-references/Attachment.md) object with file metadata and S3 utilities


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.