How to get URL of an uploaded image in v2.0 widget.

Comments

6 comments

  • Avatar
    Yakir Perlin

    Hi Gilad, 

    Could you please share with your code?

    Generally speaking, here you can find the URL:

    var widget = cloudinary.createUploadWidget({
    cloud_name: cloud_name,
    upload_preset: preset_name,
    sources: ['local', 'url'],

    }, (error, result) => {

    if (result.event === "success") {
    console.log(result.info.secure_url);
    widget.close();
    }
    });

    $("#upload_btn").click(function () {
    widget.open();
    });

     

    I'm looking forward to your response.

    Cheers,

    Yakir

    0
    Comment actions Permalink
  • Avatar
    Henning

    Im having the same issue, adding
    console.log(result.info.secure_url)
    Doesn't seem to do anything, as the widget closes after upload.

    What should I put to display the url on the widget after upload?

    0
    Comment actions Permalink
  • Avatar
    Shirly Manor

    Here is a sample code:

    https://jsfiddle.net/shirlymanor/om6u03pn/

    Can you please try to set your cloud name and upload preset and see if you can see the uploaded URL?

    0
    Comment actions Permalink
  • Avatar
    Scott Hwang

    This doesn't work, at least not anymore. It always returns "undefined."

    0
    Comment actions Permalink
  • Avatar
    Scott Hwang

    Hi. I figure it out. I had to set asynchronous to "off" in my upload preset.

    1
    Comment actions Permalink
  • Avatar
    Francis Tagbo

    Hi Scott,

    Thanks for your update.

    If there's anything else that we could help with, please don't hesitate to reach us. 

    0
    Comment actions Permalink

Please sign in to leave a comment.