0

I have a WebAPI and it is as under

[HttpPost]
[Route("AddLead")]
public void InsertLead(Document doc)
{
  leadRepository.InsertLead(doc);
}

The Document class is as under

public class Document
{
  public int DocumentId { get; set; }
  public byte[] DocumentData { get; set; }

}

Now we can make out that the property DocumentData is of Byte Array. A typical value will be

enter image description here

My client application is in AngularJS. How can I pass Byte Array to the DocumentData Field from AngularJS.?

Thanks

1
  • Is doing a base64 of the byte array an option? That way you could just post it as a string. Commented May 26, 2015 at 2:44

1 Answer 1

0

Actually you are still sending an object to ASP.NET like below. What you need to do is to fill property DocumentData with your byte[] data.

$http({
    method: 'POST', 
    data: {
       DocumentId: id,
       DocumentData: new Uint8Array()
    }

})
Sign up to request clarification or add additional context in comments.

Comments

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.