title: Unable to cast object of type 'System.Web.HttpInputStream' to type 'System.IO.FileStream' MVC 3
body: <p>I have met an issue regarding the casting type from HttpInputStream to FileStream.</p>
  
  <p>How I did ?</p>
  
  <p>I have a <code>HttpPostedFileBase</code> object and I want to have FileStream.</p>
  
  <p>I wrote:</p>
  
  <pre><code>public void Test(HttpPostedFileBase postedFile) {
    FileStream fileStream = (FileStream)(postedFile.InputStream); // throw exception
  
    FileStream anotherFileStream = postedFile.InputStream as FileStream; // null
  }
  </code></pre>
  
  <p>I tried also</p>
  
  <pre><code>public void Test(HttpPostedFileBase postedFile) {
    Stream stream = postedFile.InputStream as Stream;
  
    FileStream myFile = (FileStream)stream;
  
  }
  </code></pre>
  
  <p>But no success.</p>
  
  <p>Why at <code>postedFile.InputStream</code> comes <code>HttpInputStream</code> type ? </p>
  
  <p>And how could I solve this issue ?</p>
  
  <p>Thanks</p>