0

I Post to server as Form binary data but also some strings in other fields. In php I can read the binary data received by form by reading the temp file then store it in a variable. How can I do this in c#?

Post:

WWWForm uploadData= new WWWForm();
uploadData.AddField("warriorName", "You");
uploadData.AddBinaryData("somebinarraydataname", binarydataarray);

Server azure function app on .net core:

public async Task<HttpResponseMessage> InsertStuff([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log)
        {
//This didn't work: byte [] somebindata = req.Form["somebinarraydataname"];
byte [] somebindata = System.Text.Encoding.UTF8.GetBytes(req.Form["somebinarraydataname"]);//I get internal server error 1.1 500
string sometextdata = req.Form["warriorName"];
}

Thanks a bunch

Sergio Solorzano
  • 476
  • 9
  • 29

0 Answers0