title: ASP Net File Upload
body: <p>I am trying to read the file content from FileUpload control the following way</p>
  
  <pre><code>BinaryReader b = new BinaryReader(FileUpload1.PostedFile.InputStream);
  byte[] binData = b.ReadBytes(FileUpload1.PostedFile.ContentLength);
  </code></pre>
  
  <p>I do not want to save the file to server, instead I wanted to get Byte array and
  store it in database.</p>
  
  <p>By doing the above it not only reads the contents of the file, but it also appends the html of the posted page. How do I get only the contents from the file.</p>