Get up and running with Payload Cloudinary
This guide will help you integrate Cloudinary storage into your Payload CMS project and upload your first file.Install the package
Install the Payload Cloudinary plugin using your preferred package manager:
The plugin requires
@payloadcms/plugin-cloud-storage as a peer dependency, which should already be available in your Payload CMS project.Configure Cloudinary credentials
Add your Cloudinary credentials to your environment variables. Create or update your
.env file:.env
Add plugin to your Payload configuration
Import and configure the plugin in your
payload.config.ts:payload.config.ts
The plugin automatically:
- Disables local storage for specified collections
- Adds Cloudinary metadata fields to your media documents
- Handles file uploads, deletions, and URL generation
Upload a test file
Start your Payload dev server and test the integration:Then upload a file through the Payload admin panel:
Terminal
- Navigate to your Media collection in the admin UI
- Click Create New
- Upload an image or PDF file
- Save the document
Next steps
Now that you have Payload Cloudinary working, explore these advanced features:Basic Configuration
Customize folder structure, public IDs, and storage options
Custom Fields
Add custom fields like alt text, captions, and tags to your media
PDF Support
Enable PDF thumbnail generation and page selection
Versioning
Track file changes with version history
Troubleshooting
Files are still being saved locally
Files are still being saved locally
The plugin sets
disableLocalStorage: true automatically. If files are still being saved locally:- Verify the plugin is properly configured in
payload.config.ts - Ensure the collection slug in
collectionsmatches your Media collection exactly - Restart your dev server after making configuration changes
- Check that you don’t have conflicting upload configurations
Cloudinary credentials not working
Cloudinary credentials not working
If you’re getting authentication errors:
- Double-check your credentials in the Cloudinary dashboard
- Ensure there are no extra spaces in your
.envfile - Verify environment variables are loaded correctly with
console.log(process.env.CLOUDINARY_CLOUD_NAME) - Try regenerating your API secret if the issue persists
Files not appearing in Cloudinary folder
Files not appearing in Cloudinary folder
For newer Cloudinary accounts using Dynamic Folder Mode:
- The plugin automatically supports Dynamic Folder Mode by default
- Files will appear in the folder specified by the
folderoption - If assets aren’t showing up in the Media Library, verify the
folderparameter in your config - You can disable Dynamic Folder Mode support with
supportDynamicFolderMode: falseif needed
Custom fields not showing in admin panel
Custom fields not showing in admin panel
If your custom fields aren’t appearing:
- Verify the collection slug in your plugin config matches exactly with your Media collection slug
- Ensure the plugin is registered before collections are processed
- Try restarting your development server
- Check for field name conflicts with existing fields
- Add debug logging to verify fields are being added:
PDF thumbnails not generating
PDF thumbnails not generating
For PDF files:
- Ensure PDF support is not disabled:
enablePDFThumbnailsshould not be set tofalse - Check that the
cloudinary.public_idfield is populated after upload - Verify the PDF was successfully uploaded to Cloudinary
- The
pagesfield should be automatically populated with the page count - Use
selected_pageto choose which page to display as a thumbnail (defaults to 1)
For more detailed troubleshooting, check the complete configuration documentation or reach out to Syed Muzamil for support.