Unable to use the format when uploading an image
I am trying to upload images to cloudinary using the format argument. i want to force the conversion of all uploaded material to a .jpg ( for example if upload a .pdf i want it to be uploaded as .jpg) I am getting the error below
code:

-
Hi Abdel,
This error is returned if the signature Cloudinary calculates on our backend based on your Upload parameters doesn't match the signature you provided as part of your request.
To understand why that is, may I please ask you to share how (code snippet) you are generating the signature as part of your request? If you would like to share that privately with us then you can open a support ticket through - https://support.cloudinary.com/hc/en-us/requests/new
1 -
const timestamp = Math.round(new Date().getTime() / 1000);varsignature=cloudinary.utils.api_sign_request({timestamp:timestamp,},process.env.CLOUDINARY_SECRET);res.statusCode=200;res.json({signature,timestamp});1
-
and it only happens when i include the format in the formdata, otherwise the image gets uploaded
1 -
Thanks for sharing that.
This happens because if you want to pass additional upload parameters they need to be part of the parameters you use to generate the signature. In your current code, you only have the timestamp, so if you pass additional upload( ) parameters, such as 'format', you need to pass them in the api_sign_request( ) call as well.
May I please ask you to pass the 'format' with the value 'jpg' in your api_sign_request( ) call and then retry the uploads again? That will ensure your signature is calculated correctly to match the parameters you will send to Cloudinary.
1 -
Thank you, your solution fixed my problem !
1 -
You're welcome, Abdel! Great to hear the uploads are succeeding now.
0
Post is closed for comments.
Comments
6 comments