Image image = Image.FromFile(@"F:\image2\DSC02028.JPG");
            var data =  ImageToByteArray(image);

            var requestContent = new MultipartFormDataContent();
            //    here you can specify boundary if you need---^
            var imageContent = new ByteArrayContent(data);
            imageContent.Headers.ContentType =
                MediaTypeHeaderValue.Parse("image/jpeg");

            requestContent.Add(imageContent, "image", "image.jpg");
            using (var client = new HttpClient())
            {

                client.BaseAddress = new Uri("http://127.0.0.1:5000");

                var result = client.PostAsync("/api/values", requestContent).Result;

                //result.Content.ReadAsStringAsync().Result;

            }

 

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2022-01-08
  • 2022-03-03
  • 2022-12-23
  • 2022-02-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案