generating signature

Comments

10 comments

  • Avatar
    irv wilson

    Thank you.  The description at  http://cloudinary.com/documentation/upload_images#request_authentication was easy to follow. I believe I have that part down now.  Thanks again.  Unfortunately I still can't upload an image with a simple form. I see in the comments in your JQuery info that people are asking for a dead simple example to follow as well.  I've searched around and I cannot find any either.  I see php help that is more built out with various options but a simple JQuery based image upload page would be a lot of help. Truly it needs to be a bare bones example of uploading an image - no extra options, no image manipulation - nothing.  A good example of getting an image from a user's desktop to Cloudinary in the simplest possible way using JQuery would be a lot of help. Thank you.

    PS. If you're available to look at it I can send you a link to my test page.  Thanks. 

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Since signature generation is based on your API secret, which should not be revealed in your client-side code, the signature must be generated on the server-side. Therefore examples may vary from one framework to the other.

    For example, we have a fully working PHP sample project, which demonstrates both server-side and client-side uploading:

    https://github.com/cloudinary/cloudinary_php/tree/master/samples/PhotoAlbum

    You're always welcomed to open a ticket and share your link with us, and we'll do our best to assist.

    0
    Comment actions Permalink
  • Avatar
    Delso Lima Gomes

    Do you have an asp.net c# example of generating signature?

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    You can have a look at our open source .NET integration library, i.e.,:

    https://github.com/cloudinary/CloudinaryDotNet/blob/34d4f95a0e27b2b38fac73a29c04488c569fb224/Cloudinary/Api.cs#L437

    0
    Comment actions Permalink
  • Avatar
    larry mason

    Do you have an example that get a signature from a node.js server... I'm have a bit trouble followint the docs... Thanks. Larry

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Hi Larry,

    Here's the reference code of generating the signature via our Node.js library's  api_sign_request method:

    https://github.com/cloudinary/cloudinary_npm/blob/master/lib/utils.coffee#L352

    0
    Comment actions Permalink
  • Avatar
    Chris Isom

    i thought the support question i had might be best explained with some code. I am getting the same 

    {"error":{"message":"Missing required parameter - file"}}

     

    I am generating the signed request following these instructions:

    http://cloudinary.com/documentation/upload_images#request_authentication

    everything looks to be correct in for client side form and on the nodejs server..  but i am still gettng a 400 error with the above json response

     

     

     

    exports.signRequest = function(req, res){

    //following these instructions

    //http://cloudinary.com/documentation/upload_images#request_authentication

    var public_id, ts, serialized_params, sha1hex_digest, js;

    public_id = "public_id=image_id";

    ts = "timestamp=" + Math.round((new Date()).getTime() / 1000) + cloudinary.config().api_secret;

    serialized_params = public_id + "&" + ts;

    sha1hex_digest = cloudinary.utils.api_sign_request(serialized_params);

    js = 'MerlinConfig.cloudinary = { "hash": \"' + sha1hex_digest + '\"}';

    res.end(js);

    /*

    the above res.end(js) outputs a js file ( <script src="http://localhost:3000/imageUpload/config.js"></script>) which sets the hash of the data-form-data

    the data-form-data value in the below html is the result (i've obfuscated the hash but it looks like a correct hash)

    <form action="#">

    <input type="file" class="cloudinary-fileupload" data-cloudinary-field="image\_id" data-module="images/upload" data-form-data="obfuscated-hash" data-options-hiddenfield="nameOfField1">

    <input type="hidden" name="nameOfField1">

    <div id="files" class="files panel upload-panel"></div>

    </form>

    but i still get a

    {"error":{"message":"Missing required parameter - file"}}

    response from the server

    */

    };

    0
    Comment actions Permalink
  • Avatar
    Chris Isom

    i thought the support question i had might be best explained with some code. I am getting the same 

    {"error":{"message":"Missing required parameter - file"}}

     

    I am generating the signed request following these instructions:

    http://cloudinary.com/documentation/upload_images#request_authentication

    everything looks to be correct in for client side form and on the nodejs server..  but i am still gettng a 400 error with the above json response

     

     

     

    exports.signRequest = function(req, res){

    //following these instructions

    //http://cloudinary.com/documentation/upload_images#request_authentication

    var public_id, ts, serialized_params, sha1hex_digest, js;

    public_id = "public_id=image_id";

    ts = "timestamp=" + Math.round((new Date()).getTime() / 1000) + cloudinary.config().api_secret;

    serialized_params = public_id + "&" + ts;

    sha1hex_digest = cloudinary.utils.api_sign_request(serialized_params);

    js = 'MerlinConfig.cloudinary = { "hash": \"' + sha1hex_digest + '\"}';

    res.end(js);

    /*

    the above res.end(js) outputs a js file ( <script src="http://localhost:3000/imageUpload/config.js"></script>) which sets the hash of the data-form-data

    the data-form-data value in the below html is the result (i've obfuscated the hash but it looks like a correct hash)

    <form action="#">

    <input type="file" class="cloudinary-fileupload" data-cloudinary-field="image\_id" data-module="images/upload" data-form-data="obfuscated-hash" data-options-hiddenfield="nameOfField1">

    <input type="hidden" name="nameOfField1">

    <div id="files" class="files panel upload-panel"></div>

    </form>

    but i still get a

    {"error":{"message":"Missing required parameter - file"}}

    response from the server

    */

    };

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Hi Chris,

    You use our client integration libraries, most of the coding hassle will be done for you. For more information (in Node.js):

    http://cloudinary.com/documentation/node_image_upload#direct_uploading_from_the_browser

    In addition, we have fully working sample projects which demonstrate Cloudinary usage including client-side and server-side uploads, basic image manipulations and more. You're more than welcomed to test them out. For example, for Node.js:

    https://github.com/cloudinary/cloudinary_npm/tree/master/samples/photo_album

    If you still require our assistance, please share a URL of a live webpage where this is used so we'll be able to further understand the issue.

    0
    Comment actions Permalink

Please sign in to leave a comment.