码迷,mamicode.com
首页 > Web开发 > 详细

HttpClient 发送图片

时间:2016-08-31 18:34:11      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

var httpClient = new HttpClient();
using (FileStream fs = new FileStream("C:\\1.jpg", FileMode.Open, FileAccess.ReadWrite))
{
using (var content = new MultipartFormDataContent())
{
content.Add(new StreamContent(fs),"image",fs.Name);
var t23 = httpClient.PostAsync(string.Format("http://localhost:9700/api/Info/UploadImg?Token={0}&TimeSpan={1}&Sign={2}", token, timeSpan, serverSign), content).Result.Content.ReadAsStringAsync().Result;
}
}

HttpClient 发送图片

标签:

原文地址:http://www.cnblogs.com/luoyefeiwu/p/5826816.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!