. @vaibhav , , . saveEventually(), , . , parseFile .
, , , parseObject.
object.put("imgBytes", byteArray);
saveEventually , . , , . cloud- beforeSave-, parseFile, . , , ...
Parse.Cloud.beforeSave(Parse.Object.extend("<Name of Class>"), function(request, response){
var object = request.object;
var bytes = object.get("imgBytes");
if(bytes != null){
var parsefile=new Parse.File("img.png",bytes);
parsefile.save().then(function(file){
object.set("ImageParseFile",file);
object.set("imgBytes",null);
response.success();
},function(error){
console.error("Can't save imageBytes as ParseFile");
response.error("Error in cloud code before save");
});
}
else{
response.success();
}
});
Using the code above, it will look like a regular parsefile when retrieving an object. Even when the application is completed, the parsefile will be saved and bound to the object. Remember to change the name of your class.
source
share