router.post('/uploadImage',function(req,res){
console.log("Upload image called");
var dcod=req.body.myPhoto;
console.log("File : "+req.body.myPhoto+"\n"+dcod);
var file = {base64:dcod};
var decodedFile = new Buffer(file, 'base64');
var name ="a.jpg";
var parseFile = new Parse.File(name,decodedFile,"image/jpg");
parseFile.save().then(function()
{
console.log("inside save");
Parse.Cloud.useMasterKey();
var query = new Parse.Query(Parse.User);
query.equalTo("objectId","S8qZJM7XIA");
query.find({
success: function(results)
{
results.set("profileImg",parseFile);
results.save(null, {
success: function(results) {
params.success(Response.UpdateSuccess);
},
error: function(gameScore, error) {
console.log('Failed to create new object, with error code: ' + error.description);
}
});
}
})
},
function(error)
{
console.log("error :"+error.message);
}
);
});
我在将图像保存到Parse Cloud中的对象时遇到错误。
在parseFile.save()then(.....)
在运行时抛出错误。 即,
无法读取属性'然后'未定义的