#2
wcx6662024-08-19 09:19
|
string url = report_addr +$"thirdApi/saveHealthExamPile":
NameValueCollection nvc = new NameValueCollection ();
nve.Add("param,“{\“idNo\ :\ + sfzh + “\’,\"examDate\":\"" + tjb. Jdrq. Value. ToString("yyyy-M-dd) + "\, \"type\":\"5\}"):
var task = uploadGXTJ(lt.nvc,ms. ToArray(),url,partner_license):
async
Task<qmResult>
uploadGXTJ
LoginToken
lt.
NameValueCollection formData,
byte[]
file.
string url,
string partner_license)
try
using(HttpClient webClient = new HttpClient())
// 添加表单数据
//webClient.Headers.Add("Content-Type","multipart/form-data");
webClient. DefaultRequestHeaders.AcceptEncoding. Add(new StringWithQualityHeaderValue("utf-8"));
webClient. DefaultRequestHeaders.Add("access_token", lt.access_token);
webClient. DefaultRequestHeaders.Add("partner-license", partner_license);
using (var mformData = new MultipartFormDataContent ()
var fileContent = new StreamContent(new MemoryStream(file));
fileContent.Headers.ContentType = MediaTypeHeaderValue. Parse("multipart/form-data");
mformData.Add(fileContent,“file", Path.GetFileName("mn.jpg"));
foreach (var key in formData.AllKeys)
var keyValueContent = new StringContent(formData[key]):
mformData.Add (keyValueContent, key): // 替换为你的表单键名