NicholasByDesign NicholasByDesign - 1 month ago 20
JSON Question

Cloudinary $.cloudinary.unsigned_upload_tag response object not accessible

I have been using Cloudinary to upload images via their unsigned API. But a lot of the response text is inaccessible. I primarily need the file addition attached to the uploaded image name i.e.


myImage_xJyk.jpg.


I tried reparsing the json, looping and trying to access the object keys. How can I get the response data from an unsigned upload.

$('.upload_form').append($.cloudinary.unsigned_upload_tag("abcdefg", {
cloud_name: 'sample',
api_key: '12345678910'
},{
multiple: true,
})).bind('cloudinaryprogress', function(e, data) {
console.log(data.result.public_id);
});

Answer

The cloudinaryprogress only is relevant to the process of the upload itself, e.g., for indication of the upload progress. It doesn't know the public ID of the uploaded image yet. You'll need to bind to the cloudinarydone event instead to get the public ID of the upload image.