I am working on a Xamarin and creating cross platform mobile application.
I want to upload an image from mobile device to parse by using cloud function.
Below is the code in C# to upload the "Byte Array" to cloud function:
var byteArrContent = new ByteArrayContent(App.mByteArrayOfImage);
byteArrContent.Headers.ContentType = MediaTypeHeaderValue.Parse("image/png");
dictionary.Add ("ByteArray",byteArrContent);
And following is the cloud function which accepts the dictionary
function uploadImage(request,response){
var file = null;
var fileJson = {};
file = new Parse.File("profile.png", { base64: request.params.ByteArray.toString("base64") });
file.save({
success: function(savedFile){
fileJson = {"name":savedFile.getName(),"url":savedFile.getUrl()};
response.success(fileJson); },
error: function(error) {
response.error(false,request.params.ByteArray);
}
});
}
I am not able to upload the byte array. Parse cloud function (in main.js) always fails with error code 141. Could someone please have a look and help me in resolving this issue?