我正在通过 WCF 服务上传文件。
[OperationContract(Name = "UploadManual")]
[DataContractFormat]
[WebInvoke(Method = "POST",
UriTemplate = "UploadManual/",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json)]
string UploadManual(Stream Uploading);
执行
public string UploadManual(Stream Uploading)
{
using (FileStream writer = File.Create(System.Web.Hosting.HostingEnvironment.MapPath("~/ProductManual/Temp.txt")))
{
Uploading.CopyTo(writer);
}
return "Response"
}
但该文件与元数据一起保存,如下所示。
---------------------------acebdf13572468 内容处置:表单数据;name="fieldNameHere"; filename="FileName.txt" Content-Type: text/plain 文件内容 ---------------------------- acebdf13572468--
但我只想将内容保存在文件中。如何解决问题?