110,536
社区成员
发帖
与我相关
我的任务
分享
using (var multipartFormDataContent = new MultipartFormDataContent())
{
multipartFormDataContent.Add(new StringContent(e.Name)); //图片名字
multipartFormDataContent.Add(new ByteArrayContent(File.ReadAllBytes(e.FullPath))); //图片byte
//byte[] picdata = File.ReadAllBytes(e.FullPath);
//ByteArrayContent bytecontent = new ByteArrayContent(picdata);
HttpResponseMessage response = await client.PostAsync(CfgData.N2url,
multipartFormDataContent);
response.EnsureSuccessStatusCode();
string res = await response.Content.ReadAsStringAsync();
ShowMessage(response.IsSuccessStatusCode.ToString());
ShowMessage(res);
}