0

I am just making a PhoneGap app with Cloudinary Unsigned uploads and it's working well (i.e.,) When a user clicks anywhere on the screen the Image Picker is shown but I am just in need of showing the Image Picker only when a user clicks on a particular div.

How can I achieve this? please help.

Here is the code which I have used to attach cloudinary

$('document').append($.cloudinary.unsigned_upload_tag("bvxxxxxx", {
        cloud_name: 'sample'
    }));
    $('.uploader').unsigned_cloudinary_upload("xxxxxxcy", {
        cloud_name: 'sample'
    }, {
        multiple: true
    }).bind('cloudinarydone', function(e, data) {
            $("body").addClass("ui-loading");
            galleryMethods.savePictures(data.result.secure_url);
            // $('.thumbnails').append('<img src="' + data.result.secure_url + '" style="height:30px;width:30px;">');
            console.log("cloudinarydone");
            $("body").removeClass("ui-loading");
        }

    ).bind('cloudinaryprogress', function(e, data) {
        var progVal = Math.round((data.loaded * 100.0) / data.total);
        $("body").addClass("ui-loading");
        if (progVal == "100") {
            // cm.showAlert("Uploaded Successfully");
            $("body").removeClass("ui-loading");
        }



    });

P.S: I am using Jquery Mobile-1.4.5 framework.

Mark
  • 143,421
  • 24
  • 428
  • 436
Dinesh Raja
  • 107
  • 1
  • 1
  • 9

1 Answers1

1
  1. Did you mean document (rather than 'document')?
  2. You initialized the uploader twice. If you already have an input field set in your html, than you can use unsigned_cloudinary_upload to initialize it, otherwise you can use cloudinary.unsigned_upload_tag.
  3. I'm not sure what could make the whole screen trigger the upload. If this helps, you can take a look at the following example: https://jsfiddle.net/roee_ba/2gcquset/
Roee Ben-Ari
  • 600
  • 3
  • 12