[Django]-Upload image and string via HTTP POST windows phone 8.1 with HttpClient

7👍

Using this response ,

How to upload file to server with HTTP POST multipart/form-data

Try with this…

        HttpClient httpClient = new HttpClient();
        MultipartFormDataContent form = new MultipartFormDataContent();

        form.Add(new StringContent(token), "token");

        var imageForm = new ByteArrayContent(imagen, 0, imagen.Count());
        imagenForm.Headers.ContentType = new MediaTypeHeaderValue("image/jpg");

        form.Add(imagenForm, "image", "nameholder.jpg");

        HttpResponseMessage response = await httpClient.PostAsync("your_url_here", form);

        response.EnsureSuccessStatusCode();
        httpClient.Dispose();
        string result = response.Content.ReadAsStringAsync().Result;
👤PaytoN

Leave a comment