Unable to use the format when uploading an image

Comments

6 comments

  • Avatar
    Aleksandar Kostadinov

    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
    Comment actions Permalink
  • Avatar
    abdel
    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
    Comment actions Permalink
  • Avatar
    abdel

    and it only happens when i include the format in the formdata, otherwise the image gets uploaded

    1
    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    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
    Comment actions Permalink
  • Avatar
    abdel

    Thank you, your solution fixed my problem !

    1
    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    You're welcome, Abdel! Great to hear the uploads are succeeding now.

    0
    Comment actions Permalink

Please sign in to leave a comment.