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

Please sign in to leave a comment.