title: Read files from Stream
body: <p>I posted two files to my custom web service. Now I need to read this stream into separate files.</p>
  
  <p>I've sent an XML and a Text file and in the web service I read it as following:</p>
  
  <pre><code>StreamReader stream = new StreamReader(HttpContext.Current.Request.InputStream);
  string xmls = stream.ReadToEnd(); 
  </code></pre>
  
  <p>I get the stream as string as following (I've also added the boundaries):</p>
  
  <pre><code>"\r\n------------------------------8cfd42d26566ff0\r\nContent-Disposition: form-data; name=\"uplTheFile\"; filename=\"E:\\AJ\\Demo\\EktronSite2\\XMLFiles\\XMLFile.xml\"\r\n Content-Type: application/octet-stream\r\n\r\n﻿&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;note xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://tempuri.org/XMLFile.xsd\"&gt;\r\n  &lt;ID&gt;101&lt;/ID&gt;\r\n&lt;/note&gt;\r\n------------------------------8cfd42d26566ff0\r\nContent-Disposition: form-data; name=\"uplTheFile\"; filename=\"C:\\TEMP\\log.txt\"\r\n Content-Type: application/octet-stream\r\n\r\nABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n------------------------------8cfd42d26566ff0\r\n"
  </code></pre>
  
  <p>I need to read the same into different files. For example I need the XML read to XmlDocument type and the text to .docx. </p>
  
  <p>Thanks in advance.</p>