How to Set Structured Metadata in Cloudinary Widget?
I'm using the cloudinary upload widget and am using the following configuration:
{
cloudName: <redacted>,uploadSignature: uploadSignature,clientAllowedFormats:['image', 'video'],sources: ['local'],useFilename:true,uniqueFilename:false,apiKey: <redacted>
}
And my uploadSignature function calls "callback" on a signature object created using the passed widget params.
This uploads correctly, but the minute I add a "metadata" object to that config, it errors out. I've also tried using prepareUploadParams and adding the metadata field there (either before signing or after), and this also doesn't work.
My metadata is:
{ node_type: 'custom' } (the metadata field itself is a free-form string)
There is no documentation on how to correctly set structured metadata when using the widget- Please help!
-
Hi Ben,
Adding the metadata object to the config is not supported by the upload widget, so using the prepareUploadParams is definitely the way to go. Inspecting your logs it seems like you added the metadata field correctly, in the expected serialized format (see Asset Management>upload>Optional Parameters in https://cloudinary.com/documentation/image_upload_api_reference).Can you share some more details on the error you received when using prepareUploadParams? I suspect that the data is not being properly signed - attaching an example usage which works for your reference: https://jsfiddle.net/aleksandar_cloudinary/kjt8xqs1/
Please let me know if it works after re-signing, or what error you're receiving so that we can continue the debug.
Thanks,
EitanCreative Automation Architect,
Cloudinary
Please sign in to leave a comment.
Comments
1 comment