How save image in parse cloud using javascript -


we trying save image in parse using cloudcode. followed link. new javascript,plz guide us...! in advance.......

var url = file.url(); parse.cloud.httprequest({ url: url }).then(function(response) {   // create image data.   var image = new image();   return image.setdata(response.buffer);  }.then(function(image) {   // scale image size.   return image.scale({ width: 64, height: 64 });  }.then(function(image) {   // bytes of new image.   return image.data();  }.then(function(buffer) {   // save bytes new file.   var file = new parse.file("image.jpg", { base64: data.tostring("base64"); });   return file.save(); });  getting error 

enter image description here

there's repeated syntax mistake @ end of each function parameter then.

the syntax is:

somepromise.then(function() {     // success }).then(function() {  // code says '}.' instead of '}).'     // success }); 

there's optional error function callback second param:

somepromise.then(function() {     // success }).then(function() {     // success }, function(error) {     // error }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -