Uploading Images & Videos
Use the CldUploadButton or CldUploadWidget components to add upload capabilities to your app.
The components utilize the Cloudinary Upload Widget (opens in a new tab), built for Next.js.
Example
import { CldUploadButton } from 'next-cloudinary';
<CldUploadButton
className={styles.button}
onUpload={(error, result, widget) => {
setResource(result?.info); // Updating local state with asset details
widget.close(); // Close widget immediately after successful upload
}}
signatureEndpoint="/api/sign-cloudinary-params"
uploadPreset="next-cloudinary-signed"
>
Upload to Cloudinary
</CldUploadButton>