File metadata is saved in file body in WCF file upload by Stream

476 Views Asked by At

I am uploading a file through a WCF service.

 [OperationContract(Name = "UploadManual")]
        [DataContractFormat]
        [WebInvoke(Method = "POST",
                   UriTemplate = "UploadManual/",
                   BodyStyle = WebMessageBodyStyle.Bare,
                   ResponseFormat = WebMessageFormat.Json)]
        string UploadManual(Stream Uploading);

Implementation

public string UploadManual(Stream Uploading)
        {
            using (FileStream writer = File.Create(System.Web.Hosting.HostingEnvironment.MapPath("~/ProductManual/Temp.txt")))
            {
               Uploading.CopyTo(writer);

            }    
            return "Response"
        }

But the file is saved along with meta data as below.

---------------------------acebdf13572468 Content-Disposition: form-data; name="fieldNameHere"; filename="FileName.txt" Content-Type: text/plain File Content ---------------------------acebdf13572468--

But i want only content to be saved in the file. How to resolve the issue?

0

There are 0 best solutions below