C# function returns an empty document
<p>I have a WCF service that returns documents and images stored in a SQL Database. I am able to return all of the images with no problem. When it comes to the documents, I am able to return the document, but it is empty when I open it. The file size is correct when stepping through the code, and when opening the document it has the correct number of pages as well. Just all blank.</p>

<p>Here is what I am using to get the documents:</p>

<pre><code>String folderPath = System.Configuration.ConfigurationManager.AppSettings["ImagePath"].ToString();

 MemoryStream ms = new MemoryStream(byteArrayIn);

 FileStream fs = new FileStream(folderPath + "1" + fileExt,FileMode.Create ,FileAccess.Write);

 byte[] bytes = new byte[ms.Length];

 fs.Write(bytes, 0, bytes.Length);

 fs.Flush();

 ms.Flush();

 fs.Close();

 ms.Close();
</code></pre>

<p>I have also tried it with .pdfs and it tells me that the file may be corrupt and doesn't open.</p>

<p>Thanks for your help.</p>
