cloudinary / CloudinaryDotNet

Cloudinary DotNet library
MIT License
102 stars 68 forks source link

Upload image error with MetadataFields: "Invalid value for parameter kind" #318

Closed sa-es-ir closed 1 year ago

sa-es-ir commented 1 year ago

I'm trying to upload an image using .Net SDK, when I add MetadataFields I get error with this message : Invalid value for parameter kind but when I remove the MetadataFields it works.

Here is the code:

 var customMetadata = new StringDictionary()
            {
                {"MimeType","image/jpeg" }
            };

 var uploadParams = new ImageUploadParams()
            {
                File = new FileDescription(@"Path\test.jpg"),
                MetadataFields = customMetadata,
            };

var  result = await _cloudinary.UploadAsync(uploadParams);

The result give me the 400 bad request and in the result.error.message="Invalid value for parameter kind".

OS and Version

Versions and Libraries (fill in the version numbers)

tamaracloudinary commented 1 year ago

Hi @sa-es-ir, can you please make sure your structured metadata is set correctly in your code and try again please? (this is probably the issue from my experience) If it is set correctly, please share your cloud name so I can have a look at our logs. Thanks -Tamara

sa-es-ir commented 1 year ago

Thank you @tamaracloudinary for the response, The issue was for structured metadata! after I set them in the dashboard it works but the exception is ambiguous and don't refer to root cause. Thanks again.

tamaracloudinary commented 1 year ago

Hi @sa-es-ir, glad the issue is solved and thanks for the feedback, I'll make sure our devs take care of it. -Tamara