Fixes https://github.com/payloadcms/payload/issues/11473 Previously, when `disablePayloadAccessControl: true` was defined, client uploads were working improperly. The reason is that `addDataAndFileToRequest` expects `staticHandler` to be defined and we don't add in case if `disablePayloadAccessControl: true`. This PR makes it so otherwise and if we have `clientUploads`, it pushes the "proxied" handler that responses only when the file was requested in the context of client upload (from `addDataAndFileToRequest`)
Uploadthing Storage for Payload (beta)
This package provides a way to use uploadthing with Payload.
Installation
pnpm add @payloadcms/storage-uploadthing
Usage
- Configure the
collectionsobject to specify which collections should use uploadthing. The slug must match one of your existing collection slugs and be anuploadtype. - Get an API key from Uploadthing and set it as
apiKeyin theoptionsobject. aclis optional and defaults topublic-read.- When deploying to Vercel, server uploads are limited with 4.5MB. Set
clientUploadstotrueto do uploads directly on the client.
export default buildConfig({
collections: [Media],
plugins: [
uploadthingStorage({
collections: {
media: true,
},
options: {
token: process.env.UPLOADTHING_TOKEN,
acl: 'public-read',
},
}),
],
})