How to Add a File Picker to Your Expo App

DavidDavid October 19, 2026 8 min read

How to add a file picker to your Expo app, in short

Use expo-document-picker. Install it with npx expo install expo-document-picker, import it with import * as DocumentPicker from 'expo-document-picker', and call const result = await DocumentPicker.getDocumentAsync({ type: 'application/pdf' }) when the user taps a button. The system file browser opens. If the user picks something, result.canceled is false and result.assets[0] holds the file's uri, name, size and mimeType. If they back out, result.canceled is true and result.assets is null.

That is the core. What decides whether it works in a real app is the rest: limiting file types so users cannot pick something you cannot handle, reading the file before the uri goes stale, uploading it properly, and knowing when a different picker is the better fit. That is what this guide covers.

File picker or image picker: which one do you need?

Both open a system screen and hand you a file uri, so they are easy to mix up. They solve different jobs.

Picking the right picker in an Expo app

The user is choosingUseWhy
A photo or video from their camera rollexpo-image-pickerOpens the photo library, with options like cropping and quality.
A PDF, spreadsheet, audio file, ZIP, or any documentexpo-document-pickerOpens the system document picker, which shows the document providers available on the device.
A new photo taken right nowexpo-image-picker camera mode or expo-cameraA document picker cannot take a picture.

My recommendation: if your feature is "attach a photo", use the image picker, covered in [how to add an image picker to your Expo app](/blog/how-to-add-an-image-picker-to-your-expo-app). Asking users to dig through the Files app for a photo is a worse experience. Reach for the document picker when the thing being attached is a document, or when you genuinely want any file type.

Step 1: Install expo-document-picker

  1. Install: npx expo install expo-document-picker. Using expo install picks the version that matches your SDK.
  2. Import: import * as DocumentPicker from 'expo-document-picker'.
  3. Start testing in Expo Go. The library is included there, so you only need a development build if you turn on iCloud features or use other native modules.
  4. No permission prompt to set up. The expo-document-picker reference does not list a runtime permission, because the user picks the file in a system screen your app does not control.

That last point is a nice change from most device features. Compare it with location or the camera, where you need a usage description and a permission request; see [how to request permissions in your Expo app](/blog/how-to-request-permissions-in-your-expo-app) for those.

Step 2: Open the picker and handle the result

Put the call inside an onPress handler. Expo's docs note that on web the system UI can only be shown after user activation, such as a button press, so calling it on screen load will not work there. It is a good habit on every platform anyway: nobody wants a file browser popping up unasked.

A minimal handler: const pickFile = async () => { const result = await DocumentPicker.getDocumentAsync({ type: 'application/pdf', copyToCacheDirectory: true }); if (result.canceled) return; const file = result.assets[0]; setAttachment({ uri: file.uri, name: file.name, size: file.size, mimeType: file.mimeType }); }. Show the file name and size back to the user so they know the right file was attached.

What each picked asset gives you

FieldWhat it isNotes
uriA local uri to the fileAlways present. This is what you read or upload.
nameThe file's original nameAlways present. Good for display.
sizeSize in bytesOptional, so handle undefined.
mimeTypeThe file's MIME typeOptional, so do not rely on it alone for validation.
lastModifiedLast modified time in milliseconds since the epochPer Expo's docs, files with no known date return the current date.

Step 3: Limit which files users can pick

The type option takes a MIME type or an array of them, and supports wildcards. It defaults to '*/*', which allows anything. Narrow it to what your app can actually process.

  • PDFs only: type: 'application/pdf'.
  • Any image: type: 'image/*'.
  • A few formats: type: ['application/pdf', 'text/plain', 'text/csv'].
  • Several files at once: add multiple: true, then loop over result.assets instead of taking only the first one.

Treat the filter as a convenience, not a security check. Validate again after picking: check the size before you read or upload, check the extension or mimeType, and show a clear message if the file is not something your app supports. A user on a slow connection uploading a huge file by accident is a support ticket you can prevent with one if statement.

Step 4: Read the file with expo-file-system

The option that trips people up is copyToCacheDirectory. It defaults to true, which copies the picked file into your app's cache so other Expo APIs can read it immediately. Expo's docs say that when you use the document picker with expo-file-system, the file system cannot always read the file right after picking unless this option is true. They also note that copying can impact performance for large files, so set it to false only if users pick very large files and you do not need immediate read access.

To read the picked file, the current expo-file-system API gives you a File class. Expo's own example: import { File } from 'expo-file-system', then const file = new File(result.assets[0].uri) and file.textSync() for a text file. There is also an async text() method, bytes() for binary data, base64() for a base64 string, and properties such as size, type and exists. For a CSV or JSON import feature, text() plus a parser is usually all you need.

Step 5: Upload the picked file

Most file pickers exist to send something to a server: a resume, a receipt, a contract. Expo's file system docs show two ways to upload with the fetch built into the Expo package (import { fetch } from 'expo/fetch'):

  • Send the file as the request body: await fetch(uploadUrl, { method: 'POST', body: file }), where file is a File from expo-file-system. This suits pre-signed upload URLs.
  • Send it as form data: const formData = new FormData(); formData.append('data', file); then fetch with body: formData. This suits an API endpoint that expects multipart uploads.

Show progress or at least a loading state, disable the button while the upload runs, and handle failure with a retry. If your backend is Supabase, the storage side is covered in [how to set up Supabase with Expo](/blog/how-to-set-up-supabase-with-expo). Never put a secret storage key in the app to make uploads work; the upload should go through your authenticated backend or a short-lived signed URL.

iCloud Drive and other edge cases

  • iCloud storage: if you want iCloud features, Expo's docs say to set expo.ios.usesIcloudStorage to true in your app config. The expo-document-picker config plugin also has an iCloudContainerEnvironment option (Development or Production) used for AdHoc iOS builds. This needs a new build, not just a JavaScript update.
  • Apps without EAS Build: Expo's docs explain that you then have to configure the iCloud service and entitlements yourself in the Apple Developer Console and your entitlements file. With EAS Build, signing capabilities are handled for you.
  • Web: getDocumentAsync works on web and can return base64 and a File object for each asset, which is handy if your Expo app also ships as a website.
  • Previewing: expo-file-system has File.preview(), which opens a local file in the native viewer (Quick Look on iOS). Pair it with File.canPreview() first. If you want users to send the file onward instead, see [how to add a share sheet to your Expo app](/blog/how-to-add-a-share-sheet-to-your-expo-app).

Mistakes that break file pickers in Expo

  • Reading result.uri or result.type. That is the shape older tutorials used. Current results have canceled and an assets array; read result.assets[0].uri.
  • Reading result.assets without checking result.canceled first.
  • Setting copyToCacheDirectory to false and then wondering why expo-file-system cannot read the file.
  • Storing the cache uri as if it were permanent, then finding the file gone later.
  • Leaving type at '*/*' when the app can only process PDFs.
  • Using the document picker for camera-roll photos instead of the image picker.
  • Copying file-reading code that imports from the old expo-file-system API. Expo's docs mark methods like the old copy, delete and info functions as deprecated in the main import and say they throw at runtime; use the File class or import from expo-file-system/legacy.

Have Claude Code set it up for you

Open your project in the Claude Code desktop app and name the exact libraries and result shape. Without that, AI-written code often reads the old result.uri field or mixes old and new file-system APIs. A prompt that covers it:

Then add a line to your [CLAUDE.md](/blog/claude-md-for-expo-apps) such as "file picking uses expo-document-picker assets[]; files are read with the expo-file-system File class; never store cache uris" so a later session does not reintroduce the old patterns. Test on a real phone with a file from the Files app and a cloud provider, and test cancel, before you ship.

The short version

To add a file picker to your Expo app: install expo-document-picker, call getDocumentAsync from a button press with a narrow type filter, check result.canceled, and read result.assets. Keep copyToCacheDirectory on so expo-file-system can read the file, copy anything you need to keep into a permanent location, and upload with expo/fetch through your own authenticated backend. Use the image picker instead for camera-roll photos.

If you are building your first iOS app with Claude Code and Expo and want a second pair of eyes on it before App Review, bring it to App Store Launch Club. Members share their builds for feedback, and the [curriculum](/curriculum) covers the full path from first build to first users. Join at applaunchclub.co for $9 a month.

Free app-building tips, straight to your inbox

Short, practical drops on app ideas, validating fast, store listings, and passing app review. No spam, unsubscribe anytime.

Frequently asked questions

How do I pick a file in Expo?

Install expo-document-picker, then call DocumentPicker.getDocumentAsync() from a button press. If result.canceled is false, the picked file is in result.assets[0] with its uri, name, size and mimeType.

Does expo-document-picker work in Expo Go?

Yes, expo-document-picker is included in Expo Go. You need a new build only for native configuration such as iCloud storage features.

How do I let users pick only PDFs in Expo?

Pass type: 'application/pdf' to getDocumentAsync. The type option accepts a MIME type, an array of MIME types, or wildcards like 'image/*'. Still check the file after picking, since the filter is a convenience, not a security check.

Why can't expo-file-system read my picked file?

Usually because copyToCacheDirectory was set to false. Expo's docs say it must be true for expo-file-system to read the file immediately after picking. It defaults to true.

Can users pick multiple files at once in Expo?

Yes. Pass multiple: true to getDocumentAsync and loop over result.assets, which is an array of every picked file.

Does a file picker need a permission prompt on iOS?

The expo-document-picker reference lists no runtime permission to request. The user chooses the file in a system screen, so your app only receives the file they picked.

Should I use expo-document-picker or expo-image-picker?

Use expo-image-picker for photos and videos from the camera roll, and expo-document-picker for PDFs, spreadsheets, audio files and other documents from the Files app or cloud providers.

Last reviewed by David on October 19, 2026

David

Written by

David

Founder and app builder

Keep reading

ExpoClaude Code

How to Add Notification Actions to Your Expo App

To add notification actions to an Expo app, register a category with Notifications.setNotificationCategoryAsync, give it action buttons (and optionally a text reply), set categoryIdentifier on the notification, then read response.actionIdentifier in a response listener. Here is every action option, how to handle taps when the app was closed, the Android and iOS differences, and a Claude Code prompt that wires it all up.

David 8 min
Read article
ExpoClaude Code

How to Schedule Local Notifications in Your Expo App

To schedule local notifications in an Expo app, install expo-notifications, set a notification handler, ask for permission, create an Android channel, then call scheduleNotificationAsync with your content and a trigger like DAILY, WEEKLY or DATE. Here is every trigger type, how to cancel and list what is scheduled, why Android reminders arrive late, and a Claude Code prompt that builds the whole reminder flow.

David 8 min
Read article

Ready to build it yourself?

Join App Store Launch Club, the #1 community for building and launching apps, for $9/month.

← Back to the blog