Skip to main content

expo-document-picker

Version: 55.0.6 Provides access to the system’s UI for selecting documents from the available providers on the user’s device. On iOS, this uses UIDocumentPickerViewController, on Android it uses Intent.ACTION_GET_CONTENT, and on web it uses the HTML file input element.

Installation

Usage

API Reference

Methods

(options?: DocumentPickerOptions) => Promise<DocumentPickerResult>
Displays the system UI for choosing a documentParameters:
  • type (string | string[]): MIME types to filter documents. Defaults to '*/*'
  • copyToCacheDirectory (boolean): Copy selected file to cache directory. Defaults to true
  • multiple (boolean): Allow selecting multiple files. Defaults to false
  • base64 (boolean): Include base64 representation. Defaults to false
Returns: Promise resolving to DocumentPickerResult

Types

DocumentPickerResult

DocumentPickerAsset

string
The URI of the selected document
string
The name of the selected file
number
Size of the file in bytes
string
MIME type of the file
string | undefined
Base64 representation if requested

DocumentPickerOptions

string | string[]
MIME type(s) to filter. Examples: 'image/*', 'application/pdf', ['image/png', 'image/jpeg']
boolean
Whether to copy the selected file to the app’s cache directory. Defaults to true
boolean
Allow selecting multiple documents. Defaults to false
boolean
Include base64 representation in the result. Defaults to false

Examples

Pick a PDF File

Pick Multiple Images

Pick Document with Base64

Filter by Multiple MIME Types

Complete Example with State

Platform Support

Common MIME Types

On web, the system UI can only be shown after user activation (e.g., a button press). The canceled event may not be returned consistently across browsers due to platform restrictions.

Resources