Files
payloadcms/packages/storage-uploadthing/README.md
Sasha 810c29b189 fix!: improve collection / global slugs type-safety in various places (#8311)
**BREAKING:**
Improves type-safety of collection / global slugs by using `CollectionSlug` / `UploadCollectionSlug` and `GlobalSlug` types instead of `string` in these places:
Adds `UploadCollectionSlug` and `TypedUploadCollection` utility types

This also changes how we suggest to add an upload collection to a cloud-storage adapter:
Before:
```ts
azureStorage({
  collections: {
    [Media.slug]: true,
  },
}) 
``` 

After:
```ts
azureStorage({
  collections: {
    media: true,
  },
}) 
```
2024-11-15 19:33:26 +00:00

787 B

Uploadthing Storage for Payload (beta)

This package provides a way to use uploadthing with Payload.

Installation

pnpm add @payloadcms/storage-uploadthing

Usage

  • Configure the collections object to specify which collections should use uploadthing. The slug must match one of your existing collection slugs and be an upload type.
  • Get an API key from Uploadthing and set it as apiKey in the options object.
  • acl is optional and defaults to public-read.
export default buildConfig({
  collections: [Media],
  plugins: [
    uploadthingStorage({
      collections: {
        media: true,
      },
      options: {
        token: process.env.UPLOADTHING_TOKEN,
        acl: 'public-read',
      },
    }),
  ],
})