how to get uploaded file url from data array - JS API


1 comment

  • Avatar
    Aleksandar Kostadinov

    Hi Marshall,

    You can get `secure_url` of the uploaded resource by parsing the JSON response returned by the Upload API and then accessing it in the callback as `data.secure_url`. Please find a link to a sample JS Fiddle ( which you can use as a reference. To run it please pass a file as part of the FormData on line 3, supply the name of an upload preset on line 5, and finally replace <cloud_name> with your actual cloud name as part of the URL on line 7. Upon a successful upload, the code will extract the secure_url from the response and add it to a <p> tag on the page. Please try this out and let me know how it goes.

    Comment actions Permalink

Please sign in to leave a comment.