我有一个方法:
private bool UploadFile(Stream fileStream, string fileName)
{
HttpContent fileStreamContent = new StreamContent(fileStream);
using (var client = new HttpClient())
{
using (var formData = new MultipartFormDataContent())
{
formData.Add(fileStreamContent, fileName, fileName);
var response = client.PostAsync("url", formData).Result;
return response.StatusCode == HttpStatusCode.OK;
}
}
}
}
那是将文件发送到 WCF 服务,但是查看帖子的 Wireshark 日志,没有附加 fileStream,只是附加了文件名。我需要做其他事情吗?