title: How to get File Stream from a custom FileUpload in asp.net?
body: <p>I needed a FileUpload which would look almost same in all browsers i.e show file input field in chrome as well. So i am using a custom FileUpload
  With this code..</p>
  
  <p><strong>CSS</strong></p>
  
  <pre><code>    &lt;style type="text/css"&gt;
  
  
  
          #FileUpload {
      position:relative;
              top: -4px;
              left: 0px;
          }
  
  #BrowserVisible {
      position: absolute;
      top: -15px;
      left: 0px;
      z-index: 1;
      background:url(upload.gif) 100% 0px no-repeat;
      height:26px;
      width:240px;
  }
  
  #FileField {
      width:155px;
      height:22px;
      margin-right:85px;
      border:solid 1px #000;
      font-size:16px;
  }
  
  #BrowserHidden {
      position:relative;
      width:240px;
      height:26px;
      text-align: right;
      -moz-opacity:0;
      filter:alpha(opacity: 0);
      opacity: 0;
      z-index: 2;
  }
  
      &lt;/style&gt;
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>&lt;script src="zoom/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $('.custom-upload input[type=file]').change(function () {
          $(this).next().find('input').val($(this).val());
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="FileUpload"&gt;
      &lt;input type="file" size="24" id="BrowserHidden" runat="server" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" /&gt;
      &lt;div id="BrowserVisible"&gt;&lt;input type="text" id="FileField" runat="server" /&gt;&lt;/div&gt;
  
      &lt;asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" style="height: 26px" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>With asp.net server control it was as simple as </p>
  
  <pre><code>Stream fs = file_upload.PostedFile.InputStream;
                  BinaryReader br = new BinaryReader(fs);
                  Byte[] bytes = br.ReadBytes((Int32)fs.Length);
  </code></pre>