.NetCore表单提交文件
#region 表单提交 string url="";//提交的地址
using (var client = new HttpClient()) { var form = new MultipartFormDataContent(); //form.Add(new StringContent(UserName), "username"); //form.Add(new StringContent(PassWord), "password"); form.Add(new StringContent(fileName), "fileName"); form.Add(new StringContent(title), "title"); form.Add(new StringContent(author), "author"); form.Add(new StringContent(checkData), "checkData"); form.Add(new StringContent(version), "version"); var responseWait = client.PostAsync(url, form); responseWait.Wait(); var response = responseWait.Result; var resultWait = response.Content.ReadAsStringAsync(); resultWait.Wait(); var result = resultWait.Result; if (!string.IsNullOrWhiteSpace(result)) { var Result = JsonConvert.DeserializeObject<object>(result); } } return Result; #endregion