title: File is getting corrupted while using outputstream to upload
body: <p>Every time when I upload a excel with partial data, the uploaded file get corrupt and I am unable to use this uploaded file in aspose workbook (in some cases it works too, i don't know why). And even then I open this while, excel displays the corrupted file messaage. Here, is the snippet </p>
  
  <pre><code>InputStream stream = file.getInputStream();
  
  
  OutputStream os = new FileOutputStream("path_to_xlsFile.xls");
  BufferedOutputStream bos = new BufferedOutputStream(os);
  int bytesRead;
  byte[] buffer = new byte[8192];
  
  while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
         bos.write(buffer, 0, bytesRead);
   }
  bos.flush();
  bos.close();
  os.close();
  stream.close();
  </code></pre>
  
  <p>The error that I get while open the workbook through aspose library, for the same uploaded file is</p>
  
  <pre><code>java.lang.IllegalStateException: The FAT in the structured storage document seems to be corrupted.
  at com.aspose.cells.py.b(Unknown Source)
  at com.aspose.cells.py.b(Unknown Source)
  at com.aspose.cells.py.&lt;init&gt;(Unknown Source)
  at com.aspose.cells.Workbook.a(Unknown Source)
  at com.aspose.cells.Workbook.open(Unknown Source)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>java.lang.IllegalStateException: The structured storage seems to be corrupt.
  at com.aspose.cells.mm.&lt;init&gt;(Unknown Source)
  at com.aspose.cells.py.c(Unknown Source)
  at com.aspose.cells.py.b(Unknown Source)
  at com.aspose.cells.py.&lt;init&gt;(Unknown Source)
  at com.aspose.cells.Workbook.a(Unknown Source)
  at com.aspose.cells.Workbook.open(Unknown Source)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>java.lang.IllegalArgumentException: length
  at com.aspose.cells.b.a.d.h.b(Unknown Source)
  at com.aspose.cells.py.c(Unknown Source)
  at com.aspose.cells.py.b(Unknown Source)
  at com.aspose.cells.py.&lt;init&gt;(Unknown Source)
  at com.aspose.cells.Workbook.a(Unknown Source)
  at com.aspose.cells.Workbook.open(Unknown Source)
  </code></pre>
  
  <h2>Edit</h2>
  
  <p>If I use  file.transferTo(outputFile), then also for few files I get this exception </p>
  
  <pre><code>java.lang.IllegalStateException: The FAT in the structured storage document seems to be corrupted.
  at com.aspose.cells.py.b(Unknown Source)
  at com.aspose.cells.py.b(Unknown Source)
  at com.aspose.cells.py.&lt;init&gt;(Unknown Source)
  at com.aspose.cells.Workbook.a(Unknown Source)
  at com.aspose.cells.Workbook.open(Unknown Source)
  </code></pre>