title: Write Binary File
body: <p>I am reading data from an IPhone App that uses http POST to transfer the image to the Server I can read this into a an binary and it does write to a file (See below) the issue I have is when I open the image it fails.</p>
  
  <p>You can see the code from the Iphone on this post:
  <a href="https://stackoverflow.com/questions/1547967/asp-http-post-read-data">asp http POST Read Data</a></p>
  
  <p>Code:</p>
  
  <pre><code>byte[] buffer = new byte[Request.ContentLength];
  using (BinaryReader br = new BinaryReader(Request.InputStream))
      br.Read(buffer, 0, buffer.Length);
  
  string fileName = @"C:\test\test.jpg";
  FileStream fs = new FileStream(fileName, FileMode.Create, 
      FileAccess.ReadWrite);
  BinaryWriter bw = new BinaryWriter(fs);
  bw.Write(buffer);
  bw.Close();
  </code></pre>
  
  <p>The image Content-Type is application/octet-stream</p>
  
  <p>Can anyone shine any light onto this please.</p>