Skip to main content

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

Comments

6 comments

  • Scott Hwang

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

    1
  • 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
  • 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
  • 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
  • Scott Hwang

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

    0
  • 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

Post is closed for comments.