This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

What is the proper way to handle signed client upload (via XHR) in Django?

Comments

1 comment

  • Avatar
    Daniel Mendoza

    @Interio

    We apologize for the late reply.

    1. Is there a way to verify the payload sent from the client? Maybe a checksum signed using the server password? (see hoe google Recaptcha words as an example)?

    The signature of the upload can be verified by comparing the return signature. By using the public_id and version from the upload response, you can use the api_secret on your server to generate the signature and compare them.

    • expected_signature = cloudinary.utils.api_sign_request(dict(public_id=public_id, version=version),cloudinary.config().api_secret)

    2. What is the proper way to populate a CloudinaryField from an absolute image URL?

    I have found a Cloudinary function that will generate the needed string to populate CloudinaryField:

    from cloudinary import CloudinaryResource
    
    . . .
    res = CloudinaryResource(public_id='test', type='upload', resource_type='image', version=123456789, format='png')
    
    print(res.get_prep_value())
    
    

    The output produced would be "image/upload/v123456789/test.png".

    3. Is it possible to receive a callback to the server with the payload when a client upload using XHR finishes?

    There are three options that can be done:

    0
    Comment actions Permalink

Post is closed for comments.