Skip to main content

signed direct upload with ruby on rails and upload widget

Comments

3 comments

  • Yakir Perlin

    Hi, 

    Can you please point me to `sign_request` function?

     

    Thanks

    0
  • Devis Battisti

    It's from official Cloudinary ruby gem:

    https://github.com/cloudinary/cloudinary_gem/blob/5efe1b5e693c8b1b3f439d85c50d198c678e223d/lib/cloudinary/utils.rb#L639

     

    I think the problem is what to put inside the params_to_sign object.

    Now it's (ruby code)

    params_to_sign = {folder: ENV.fetch('CLOUDINARY_FOLDER'), source: "uw"}
    0
  • Muhammad Zakwan

    I have managed to do it. In my project params_to_sign consist of 3 items which "public_id", "source" and "timestamp". The code will be as below:

    TimeStamp = Time.now.to_i
    params_to_sign = {public_id: "Sample", source: "uw", timestamp: TimeStamp}
    Signature = Cloudinary::Utils.api_sign_request(params_to_sign, Rails.application.credentials.cloud_secret)

    Next, in your upload widget code, you must add publicId params that have the same value with public_id param in your params_to_sign signature. Hope this help you.

    1

Post is closed for comments.