0

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?

2
  • Please show us the upload-function in Xamarin where you are doing the actual web request. What do you mean with "cloud function" in the second sample? Is it Node.js? Commented Sep 11, 2015 at 7:24
  • look at this ...add respose in your cloud function like this..stackoverflow.com/questions/23856595/… Commented Sep 11, 2015 at 14:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.