How to allow both upload and reference existing documents in Sanity file field?

11 repliesLast updated: Dec 1, 2025

I feel like this is an easy solution but I just can’t find it. Just a simple file type but it currently only allows to upload a document and not use an existing one. In the block type I needed two separate annotation items to do this but in a simple file type can it set to allow uploading a new document or use an existing one?
AI Update

The file type in Sanity Studio v3 doesn't automatically provide both upload and browse/select functionality by default in the way you might expect. Let me clarify what's actually happening:

What the file field provides by default

When you define a basic file field, the Studio will show an upload interface that allows you to:

About asset sources

The key to accessing existing files is the options.sources property. This controls which asset sources are available to the file field. Asset sources can include:

{
  name: 'myFile',
  type: 'file',
  title: 'My File',
  options: {
    sources: [] // Configure which sources are available
  }
}

Why annotations need two separate items

In Portable Text annotations, you're working within inline text marks, which have different constraints than standalone fields. That's why you needed separate annotation definitions - one for uploading/linking new files and one for referencing existing file documents.

Accessing existing files

To browse and select from previously uploaded files in your Sanity asset library, you'll want to ensure your file field has access to the default Sanity asset source. The documentation mentions custom asset sources as a way to control and extend this functionality.

If you're not seeing the ability to browse existing files, check:

The file type works similarly to the image type in terms of asset management, but the documentation doesn't explicitly state that a "browse existing" button appears by default - it focuses more on the upload functionality and the ability to configure asset sources.

Show original thread
11 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions