Ruchi yadav
Ruchi yadav

Reputation: 243

Cloudinary - Upload preset must be in whitelist for unsigned uploads

I want to upload image, to Cloudinary, taken directly from camera in Ionic using cordova camera plugin. I am getting an error of code 1, having message "upload preset must be in whitelist for unsigned uploads." How to solve this error.Please help.

my edited js code is:

    $scope.cameraopen = function(){
   var options = {
         quality : 100,
         destinationType : Camera.DestinationType.FILE_URI,//FILE_URI
         sourceType : Camera.PictureSourceType.CAMERA,
         allowEdit : false,
         encodingType: Camera.EncodingType.JPEG,
         popoverOptions: CameraPopoverOptions,
         targetWidth: 500,
         targetHeight: 500,
         saveToPhotoAlbum: true
     };
$cordovaCamera.getPicture(options).then(function(imageData) {

var Uploadoptions = {
              upload_preset: cloudinary.config().upload_preset,
              tags: 'mytag',
              context: 'photo=photo', 
              file: imageData
            };

       var onUploadSuccess = function(data){
        console.log("success"+JSON.stringify(data));
       }
       var onUploadFail = function(e){
        console.log("error"+JSON.stringify(e));
       }

       var ft = new FileTransfer();
 ft.upload(imageData, "http://api.cloudinary.com/v1_1/" + cloudinary.config().cloud_name + "/upload", onUploadSuccess, onUploadFail, Uploadoptions, true); 
    }, function(err) {
      // error
    });
}

Upvotes: 7

Views: 9227

Answers (2)

Yuvraj Singh
Yuvraj Singh

Reputation: 69

Yes, You need to go Cloudinary > Setting > Upload > Presets then click edit and change into **UnSigned Upload **

Then Your Error 100% resolved. Please support us for work.

enter image description here

Upvotes: 1

Stephen Ngethe
Stephen Ngethe

Reputation: 1044

First, you need to enable unsigned uploading for your Cloudinary account from the Upload Settings page.

Please refer the blog post on direct uploads from the browser and check. It can happen if some data necessary for the POST request is missing.

Upvotes: 3

Related Questions