Your Payload project needs product photos, PDFs and maybe video, and every file has to upload, resize, survive the next deploy and load for the right people. Payload handles uploads through its collections, so there’s no separate media service to add.
As of 17 November 2026, in Payload 3.93.0, one option turns any collection into an upload collection, and six official storage adapters move the files off your server.
We build client projects on Payload from our own project template, which stores its media through a storage adapter, Vercel Blob by default.
- What happens when you turn on uploads?
- How do you set up a media collection?
- Image sizes, cropping and focal point
- File types and upload size limits
- Where do uploaded files live?
- How do you upload large files on serverless hosts?
- Who can read your uploaded files?
- Serving uploads through a CDN
- Uploading files through the REST and Local APIs
- Organising uploads with folders
- How we handle uploads on our builds
- What changes in Payload 4
- Frequently asked questions
- What to do next
What happens when you turn on uploads?
Setting upload: true on a collection, or passing an object of upload options, makes every document in it a file. Payload adds filename, mimeType, filesize, width, height and url fields, plus focalX and focalY for the focal point, and a sizes group when you define image sizes. The admin panel shows a file picker on the edit view, thumbnails in the list view, and bulk upload.
Each file gets a route, /api/{collection-slug}/file/{filename}, and that is the url the document returns. With no storage adapter, Payload writes the file to disk in staticDir, which defaults to a folder named after the collection’s slug.
For example, a furniture retailer in Dubai keeps product photos, assembly guides as PDFs and showroom walkthrough videos in a media collection, and a trade price list that only trade customers may download. A sofa photo uploaded there comes back as a document with its filename, its size in bytes, its dimensions and a url of /api/media/file/sofa-sand.jpg.
If you don’t have a project yet, our Payload tutorial starts from the blank template, which already includes a media collection.
How do you set up a media collection?
A media collection needs the types it accepts, the image sizes your front end uses, and the fields editors fill in, such as alt text. For example, the retailer’s accepts images, PDFs and MP4 video:
import type { CollectionConfig } from 'payload'
export const Media: CollectionConfig = {
slug: 'media',
access: {
read: () => true,
},
upload: {
mimeTypes: ['image/*', 'application/pdf', 'video/mp4'],
imageSizes: [
{ name: 'thumbnail', width: 400, height: 300 },
{
name: 'card',
width: 768,
height: 576,
formatOptions: { format: 'webp', options: { quality: 80 } },
},
{ name: 'zoom', width: 2000 },
],
adminThumbnail: 'thumbnail',
},
fields: [{ name: 'alt', type: 'text', required: true }],
}Other collections point at it with an upload field. The products collection holds a gallery, filtered so editors can only pick images:
{
name: 'gallery',
type: 'upload',
relationTo: 'media',
hasMany: true,
filterOptions: { mimeType: { contains: 'image' } },
}The upload field stores a reference to the media document, the same way a relationship does, and our guide to Payload fields puts it beside the other field types. Images inside rich text work through the editor’s upload feature, which our rich text editor guide covers.
Image sizes, cropping and focal point
Payload resizes images with Sharp when a file is uploaded, creating one file per entry in imageSizes. Sharp must be passed to your config as sharp, which create-payload-app does for you. Without it, Payload stores the original and creates no sizes.
Each size takes a name, a width and a height, plus Sharp’s resize options. When a size’s shape differs, Payload crops around the focal point, so position only applies with focalPoint: false. Leave out the height and Payload keeps the aspect ratio, so the retailer’s zoom size of a 4000 by 3000 photo comes out at 2000 by 1500, saved as sofa-sand-2000x1500.jpg. By default a size larger than the original is skipped, and its entry in sizes comes back empty. Set withoutEnlargement: false to enlarge instead, or true to fall back to the original.
Editors get a crop tool in the admin panel, and a focal point selector once the collection has image sizes. Cropping happens before resizing, so every size comes from the cropped image. The focal point decides what stays in frame when a size crops to a different shape. For example, an editor drags it onto the armchair in a wide room shot, and the 400 by 300 thumbnail keeps the armchair.
formatOptions on the upload config converts the original file, and image sizes don’t inherit it. Set formatOptions on each size you want in WebP or AVIF, as the card size does above. Payload resizes JPEG, PNG, GIF, WebP, TIFF and AVIF files, and stores SVGs and other types as they are.
Payload creates the sizes when a file is uploaded or replaced, or when an editor changes its crop or focal point. A size you add to the config later appears on a stored file only after one of those.
File types and upload size limits
mimeTypes lists the types a collection accepts, such as image/* or application/pdf. Payload checks it on the server against the type it detects in the file’s contents, and falls back to the extension when the contents don’t show one. Without mimeTypes, Payload refuses a built-in list of restricted types, including executables, HTML, JavaScript and other scripts. Setting mimeTypes replaces that list with your own, so name every type you want.
Since Payload 3.90.0 (18 September 2026), uploads over HTTP have default limits. Each file can be up to 20 MiB, a request can carry up to 3 files, and the whole request can be up to 50 MiB. Anything larger is rejected with a 413 error. These limits apply to multipart requests, which covers REST uploads and the admin panel’s upload form, and not to files you create with the Local API.
You raise them in the upload key of your Payload config. For example, the retailer’s assembly guides run to 40 MB:
export default buildConfig({
// ...
upload: {
limits: { fileSize: 40 * 1024 * 1024 },
},
})The 50 MiB request limit stays in place, so a file near it also needs requestSizeLimit raised. The retailer’s 300 MB showroom videos are past both, and on a serverless host they would fail sooner still.
Where do uploaded files live?
By default, on the server’s disk. That suits a long-running server with a persistent, backed-up disk, and fails on serverless and container hosts, where files written to disk are gone after the next deploy or restart. Our Payload hosting guide covers which hosts keep their disk.
A storage adapter sends files to object storage instead and switches off local storage for the collections you list. Payload publishes six, all at 3.93.0 and all built on @payloadcms/plugin-cloud-storage, which each adapter installs for you:
| Adapter | Stores files in | Runs on | Worth knowing |
|---|---|---|---|
@payloadcms/storage-s3 | Amazon S3 or any S3-compatible service | any Node.js host | acl, signed downloads, client uploads |
@payloadcms/storage-vercel-blob | Vercel Blob | any host, built for Vercel | writes public files, client uploads |
@payloadcms/storage-r2 | Cloudflare R2 through a Workers binding | Cloudflare Workers only | labelled beta in Payload’s docs |
@payloadcms/storage-azure | Azure Blob Storage | any Node.js host | creates new containers as private |
@payloadcms/storage-gcs | Google Cloud Storage | any Node.js host | bucket settings apply unless you set acl |
@payloadcms/storage-uploadthing | Uploadthing | any Node.js host | public by default, removed in Payload 4 |
Each adapter goes in your config’s plugins array, with a collections object naming the upload collections it handles.
Amazon S3
@payloadcms/storage-s3 takes a bucket name and the AWS SDK’s client config, so credentials, region and a custom endpoint for other S3-compatible services all go where the SDK expects them:
import { s3Storage } from '@payloadcms/storage-s3'
export default buildConfig({
// ...
plugins: [
s3Storage({
collections: {
media: true,
'trade-documents': { signedDownloads: true },
},
bucket: process.env.S3_BUCKET!,
clientUploads: true,
config: {
region: process.env.S3_REGION,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID!,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
},
},
}),
],
})acl sets each file’s access control list, and when you leave it out the bucket’s own settings apply.
Vercel Blob
@payloadcms/storage-vercel-blob needs your store’s read-write token. Vercel now connects stores through OIDC by default, so tick the option that adds BLOB_READ_WRITE_TOKEN when you connect the store. Without a token the adapter switches itself off, and files go back to local disk.
import { vercelBlobStorage } from '@payloadcms/storage-vercel-blob'
export default buildConfig({
// ...
plugins: [
vercelBlobStorage({
collections: { media: true },
token: process.env.BLOB_READ_WRITE_TOKEN,
clientUploads: true,
}),
],
})Files keep their own names unless you set addRandomSuffix: true, and the adapter tells browsers and Vercel’s CDN to cache each file for a year (cacheControlMaxAge, in seconds). Set it yourself with client uploads, which otherwise get Blob’s one-month default. In 3.93.0 its files are always public, which matters for gated files. Connect a public Blob store, since the adapter can’t write to a private one.
Cloudflare R2
R2 has two routes. On Vercel, Netlify or any Node.js host, use the S3 adapter against R2’s S3-compatible API, with region: 'auto', your account’s R2 endpoint and forcePathStyle: true in the client config. R2’s S3 endpoint isn’t public, so serving files straight to visitors needs the bucket’s public r2.dev address or a custom domain, passed in through generateFileURL, with disablePayloadAccessControl: true for a public collection:
s3Storage({
collections: {
media: {
disablePayloadAccessControl: true,
generateFileURL: ({ filename, prefix }) =>
`${process.env.R2_PUBLIC_URL}/${prefix ? `${prefix}/` : ''}${filename}`,
},
},
bucket: process.env.R2_BUCKET!,
config: {
region: 'auto',
endpoint: process.env.R2_ENDPOINT,
forcePathStyle: true,
credentials: {
accessKeyId: process.env.R2_ACCESS_KEY_ID!,
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
},
},
})@payloadcms/storage-r2 is for Payload running on Cloudflare Workers, where it takes the R2 bucket binding directly. Payload’s docs label it beta, and Payload’s Cloudflare template uses it.
Azure, Google Cloud Storage and Uploadthing
The Azure and Google Cloud Storage adapters follow the same shape, with a connection string and container for Azure and a bucket and client options for Google. The Azure adapter creates new containers as private, and the Google adapter leaves each file to the bucket’s own settings unless you set acl.
The Uploadthing adapter defaults its acl to public-read. It has no Payload 4 beta release, and the Payload 4 migration guide removes it, so for a new project pick one of the other five.
How do you upload large files on serverless hosts?
Upload them from the browser straight to storage, with clientUploads: true on the adapter. On Vercel, a function’s request body is capped at 4.5 MB, so a normal upload of a larger file fails with a 413 before Payload sees it.
With client uploads on, the admin panel asks Payload for permission first. Payload checks that the user is signed in and has create or update access on the collection, and the adapter returns a signed upload URL (or a token, for Vercel Blob). The browser sends the file there, and Payload then creates the document from the file’s details.
For example, the showroom videos go straight from the editor’s browser to S3. The file never passes through Payload’s upload parser, so the 20 MiB default doesn’t apply to it. On S3, a fileSize you set yourself in upload.limits caps the signed upload.
For S3 and Google Cloud Storage, add a CORS rule to the bucket that allows PUT requests from your site’s origin, and on S3 allow the If-None-Match header too. Azure needs a CORS rule that allows PUT too, and a wider one with its x-ms- headers when you turn on chunkLargeFiles for very large files.
Who can read your uploaded files?
Anyone your collection’s read access allows, as long as they fetch the file through Payload’s URL. Payload runs that rule on /api/{collection-slug}/file/{filename} too, and a rule can return a query, so readers can be limited by role or by a field on the document (role-based access control). Our Payload authentication guide covers how Payload knows who the user is.
For example, the retailer keeps its trade price list in a separate trade-documents collection that only trade accounts can read, using a tradeAccount checkbox on its users:
export const TradeDocuments: CollectionConfig = {
slug: 'trade-documents',
access: {
read: ({ req }) => Boolean(req.user?.tradeAccount),
},
upload: { mimeTypes: ['application/pdf'] },
fields: [{ name: 'title', type: 'text', required: true }],
}Storage adapters keep that URL by default. Payload receives the request, runs the read rule, then fetches the file from storage and returns it.
Two options hand out the storage URL instead. disablePayloadAccessControl: true makes url point at the file in the bucket, and generateFileURL builds the URL yourself, for example on a CDN domain. Either way, requests go to storage or your CDN and Payload’s read rule no longer runs, so they suit collections everyone may read.
The Vercel Blob adapter in 3.93.0 writes every file as a public blob, even though Vercel Blob itself now offers private stores. The read rule still guards Payload’s URL, while anyone who has the file’s Blob address can download it. Keep files that must stay private in a collection on an adapter with private storage, such as S3 with signedDownloads.
With signedDownloads, the S3 adapter runs the read rule, then redirects the reader to a presigned URL that expires after 7,200 seconds by default. The file then streams straight from S3, which helps with large files such as video.
Serving uploads through a CDN
Choose the URL for each collection, because it decides both speed and access:
The url points at | Set with | Read access | Every request reaches |
|---|---|---|---|
| Payload’s file route | the default | runs | your server, which fetches from storage |
| The file in storage | disablePayloadAccessControl: true | doesn’t run | storage, or its CDN |
| Your own domain | generateFileURL | doesn’t run | your CDN, then storage |
Public product photos load fastest from storage or a CDN, because no request has to wait for your server. The retailer serves its media collection from Cloudflare in front of its bucket, with generateFileURL returning the CDN address, and keeps trade-documents on the default route with signed downloads.
On Vercel Blob, the Blob URL is already served from Vercel’s CDN, and the adapter sets a cache lifetime of one year on files uploaded through Payload. On S3, put CloudFront or another CDN in front of the bucket and return its address from generateFileURL. Payload’s own route can sit behind a CDN too. On local disk and most adapters it sends no Cache-Control header, but the Vercel Blob adapter marks every file public for a year. A cached copy is served without the read rule, so cache only public collections there.
Rendering those URLs with next/image on a Next.js front end is covered in our guide to Payload and Next.js.
Uploading files through the REST and Local APIs
Upload over REST by sending multipart/form-data to the collection’s create route, with the file in file and the other fields as JSON in _payload:
const form = new FormData()
form.append('file', fileInput.files[0])
form.append('_payload', JSON.stringify({ alt: 'Oak dining table, side view' }))
await fetch('/api/media', {
method: 'POST',
body: form,
credentials: 'include',
})Let the browser set the Content-Type header, because it adds the multipart boundary. The request runs the collection’s access rules and hooks, and the default upload limits apply.
In server code, the Local API’s create takes filePath for a file on disk, or file for one you hold in memory, with its data buffer, mimetype, name and size. For example, the retailer imports a supplier’s photos from a folder:
import path from 'path'
await payload.create({
collection: 'media',
data: { alt: 'Rattan lounge chair, front' },
filePath: path.resolve('imports/rattan-chair.jpg'),
})Hooks still run, and overwriteExistingFiles: true replaces a file with the same name instead of saving a numbered copy. GraphQL doesn’t take file uploads, so upload with REST or the Local API and reference the media document’s ID. Our guide to Payload’s APIs covers each one beyond uploads.
Organising uploads with folders
Payload’s folders feature lets editors group documents into nested folders in the admin panel. Set folders: true on a collection, and Payload adds a folder field to it, a payload-folders collection for the folders themselves, and a browse-by-folder view. Payload’s docs label the feature beta in version 3.
For example, the retailer’s editors file product photos under Sofas, Dining and Outdoor, with a folder per range inside each. Each folder can also be limited to certain collections.
Folders organise the admin panel only. They don’t change a file’s URL or where it sits in storage.
If you searched for Payload’s folder structure in the sense of where its code lives in a project, our Next.js guide covers keeping collections, hooks and access rules in their own folders.
How we handle uploads on our builds
Our template (v2.13.1, November 2026, on Payload 3.93.0) ships one upload collection, media, with required alt text. It accepts a fixed list of types (images, MP4 and WebM video, MP3 and WAV audio, PDF, plain text, CSV, and Word and Excel files). Upload fields elsewhere in the template point at it, for tenant logos, user avatars, page blocks, and header and footer images.
By default, files go to Vercel Blob through Payload’s official adapter, and a project can swap in another storage adapter. On Blob, a deployment without a token stops with a clear error rather than writing files to a disk that won’t survive the deploy. Local development without a token keeps files on disk.
Media is public by design. Anyone can read it, only content roles can create, change or delete it, and on Blob, files are served straight from the Blob URL rather than through Payload. We don’t keep private files in the media collection.
Client uploads are on for Blob, so the browser sends files straight to the store, and only content roles can use them. The template defines no image sizes and doesn’t turn on folders. Our front ends render each file’s URL in a plain image tag, and on multi-tenant projects each tenant has its own media library.
If you’d like a Payload build shaped around your content and your hosting, see our Payload CMS development service.
What changes in Payload 4
As of 4.0.0-beta.9 (13 November 2026), Payload 4 changes uploads in five ways, checked in the published package and the Payload 4 migration guide:
- Storage adapters move from
pluginsto a new top-levelstoragearray, and adapters left inpluginsno longer work. A codemod moves them. - Sharp leaves Payload’s core for a separate package,
@payloadcms/transformer-sharp, registered underupload.transformers. Image sizes becomevariantson the transformer, and a collection that still setsimageSizesor the Sharp options onuploadfails the build. A second codemod converts those. - The Uploadthing adapter is removed.
- Upload collections keep each original file, and client uploads go through one
POST /api/upload-instructionsroute for every adapter. - Folders become a preset of a new hierarchy feature, alongside tags.
For example, the retailer’s thumbnail, card and zoom sizes would keep their names and dimensions and move into variants for the media collection on sharpTransformer.
Betas change between releases, so check the guide again before you upgrade.
