# File Picker

{% embed url="<https://www.youtube.com/watch?v=nPQiBWPF4ZQ>" %}

Watch this on Youtube: <https://www.youtube.com/watch?v=nPQiBWPF4ZQ>

The File Picker action allows users to select a file from their device. This action supports filtering by file type, setting size limits, and optionally showing a toast after selection.

## Properties

| Property        | Type      | Required | Description                                                                              |
| --------------- | --------- | -------- | ---------------------------------------------------------------------------------------- |
| `File Type`     | Dropdown  | No       | Select allowed file type: `"audio"`, `"pdf"`, or `any` for any file type.                |
| `Size Limit`    | `number`  | No       | Maximum file size allowed in KB. Files exceeding this limit are filtered out.            |
| `Show Toast`    | `boolean` | No       | Whether to show a toast notification for files exceeding size limit. Defaults to `true`. |
| `File Variable` | Dropdown  | No       | Select variable where the selected file will be stored.                                  |

## Use Cases

* **Document Upload**: Allow users to upload PDFs, documents, or certificates
* **Audio Files**: Select music files, voice recordings, or podcasts
* **Form Attachments**: Attach files to forms, applications, or messages
* **Media Libraries**: Build collections of user-uploaded content
* **Data Import**: Allow users to import data files for processing

## Default Behavior

By default:

| Behavior              | Description                                                |
| --------------------- | ---------------------------------------------------------- |
| **File Types**        | All file types allowed if `File Type` not specified        |
| **Selection Mode**    | Single file selection                                      |
| **Size Limits**       | No size restrictions if `Size Limit` not specified         |
| **Toast Display**     | Shows size limit warnings unless `Show Toast` is false     |
| **File Storage**      | Selected file stored in specified `File Variable` variable |
| **User Cancellation** | Action completes without error if user cancels picker      |

## How to Use

<figure><img src="/files/Ed8dVqvHWumUNavXEZ56" alt="Call External Method action configuration showing message name and payload fields"><figcaption><p>Call External Method action configuration in Digia Studio</p></figcaption></figure>

1. Attach the action to a widget event (button tap, icon press, etc.)
2. Select **File Picker** from the action list
3. Optionally specify `File Type` to restrict file types
4. Set `Size Limit` in KB to restrict file sizes
5. Specify `File Variable` variable to store selected file

## Implementation Details

The action uses the `file_picker` package to access device file systems. Selected files are converted to `AdaptedFile` objects containing file data, metadata, and size information.

Size limits are enforced in KB (converted to bytes internally). Files exceeding the limit are automatically filtered out, and users see toast notifications when `Show Toast` is enabled.

## Related Actions

* [Image Picker](/logic-and-interaction/actions/image-picker.md) - Select images and videos with camera/gallery options
* [Upload](/logic-and-interaction/actions/upload.md) - Upload selected files to a server
* [Set State](/logic-and-interaction/actions/set-state.md) - Update UI state with selected files

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digia.tech/logic-and-interaction/actions/file-picker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
