As you can see, I am trying to send an image, and a name through a POST command to a local function.
How Can I read both of these parameters in C#?
This is what I have tried but It can only read File Image.
[FunctionName("Test")]
public static async Task<HttpResponseMessage>
Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route =
null)]HttpRequestMessage req, TraceWriter log)
{
//Check if the request contains multipart/form-data.
if (!req.Content.IsMimeMultipartContent())
{
return req.CreateResponse(HttpStatusCode.UnsupportedMediaType);
}
foreach (var stream in contents.Contents)
{
try
{
var fileBytes = await stream.ReadAsByteArrayAsync();
var fileinfo = new FileInfo(stream.Headers.ContentDisposition.FileName.Trim('"'));
//Can Read File image like this.
}
catch(Exception e)
{
return req.CreateErrorResponse(HttpStatusCode.Conflict, e);
}