title: OpenXML/SpreadsheetLight: File contains corrupted data for xlsx - Only happens on server
body: <p>I'm having a very strange problem. I am trying to use the OpenXML/SpreadsheetLight library to process the data of a user uploaded excel file (only .xlsx not .xls), however I am getting an error when trying to run the code on a live server.</p>
  
  <p>I tested the code on my local machine and on a staging server instance, in both cases I uploaded a .xlsx file and the code was able to process it correctly. However when testing on our live server, and using the exact same .xlsx file, the code spits out this error: <code>File contains corrupted data.</code></p>
  
  <p>What I have tried so far:</p>
  
  <ol>
  <li>I checked that the file was actually uploaded to the Temp directory on the server.</li>
  <li>I checked that the IIS user has permissions to access the file in the Temp directory.</li>
  <li>I checked that the uploaded file was not corrupted and could be opened with Excel.</li>
  <li>Clean build and re-deploy the code (ensuring that the exact same code that was on the staging server made it to the live server).</li>
  <li>Redeployed the DocumentFormat.OpenXml.dll and SpreadsheetLight.dll to the server.</li>
  </ol>
  
  <p>At this point I'm not sure what else to check or what the issue could be, any suggestions on what it could possibly be are welcome.</p>
  
  <p>Here is my Error Message/Stack Trace:</p>
  
  <pre><code>File contains corrupted data. : at MS.Internal.IO.Zip.ZipIOExtraFieldZip64Element.ParseDataField(BinaryReader reader, UInt16 size)
     at MS.Internal.IO.Zip.ZipIOExtraFieldElement.Parse(BinaryReader reader, ZipIOZip64ExtraFieldUsage zip64extraFieldUsage)
     at MS.Internal.IO.Zip.ZipIOExtraField.ParseRecord(BinaryReader reader, ZipIOZip64ExtraFieldUsage zip64extraFieldUsage, UInt16 expectedExtraFieldSize)
     at MS.Internal.IO.Zip.ZipIOLocalFileHeader.ParseRecord(BinaryReader reader, Encoding encoding)
     at MS.Internal.IO.Zip.ZipIOLocalFileBlock.ParseRecord(BinaryReader reader, String fileName, Int64 position, ZipIOCentralDirectoryBlock centralDir, ZipIOCentralDirectoryFileHeader centralDirFileHeader)
     at MS.Internal.IO.Zip.ZipIOBlockManager.LoadLocalFileBlock(String zipFileName)
     at MS.Internal.IO.Zip.ZipArchive.GetFile(String zipFileName)
     at MS.Internal.IO.Zip.ZipArchive.GetFiles()
     at System.IO.Packaging.ZipPackage.ContentTypeHelper..ctor(ZipArchive zipArchive, IgnoredItemHelper ignoredItemHelper)
     at System.IO.Packaging.ZipPackage..ctor(Stream s, FileMode mode, FileAccess access, Boolean streaming)
     at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
     at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(Stream stream, Boolean readWriteMode)
     at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(Stream stream, Boolean isEditable, OpenSettings openSettings)
     at SpreadsheetLight.SLDocument.OpenExistingSpreadsheet(String SheetNameOnOpen)
     at MyProjectName.FileUploader.LoadFileFromExcelFile() in c:\Users\Username\MyProjectName\FileUploader.aspx.cs:line 123
  </code></pre>
  
  <p>Here is the actual code:</p>
  
  <pre><code>// Make sure a file was uploaded
  if (MyFileUpload.HasFile &amp;&amp; !string.IsNullOrEmpty(MyFileUpload.FileName))
  {
      // Make sure the file is a .xlsx
      string fileExt = Path.GetExtension(MyFileUpload.FileName);
      if (fileExt.ToLower() == ".xlsx")
      {
          // Upload File to Temp directory
          string filePath = string.Empty;
          string filename = Path.GetFileName(MyFileUpload.FileName);
          string targetFolder = System.IO.Path.GetTempFileName(); 
  
          filePath = targetFolder + filename;
  
          // Replace any existing file at that location
          if (System.IO.File.Exists(filePath))
          {
              System.IO.File.Delete(filePath);
          }
  
          MyFileUpload.SaveAs(filePath);
  
          // Open the file for use
          using (SLDocument theSpreadsheet = new SLDocument(filePath, "Sheet1")) // &lt;-- Error occurs here
          {
              // Do stuff with the file here...
          }
      }
  }
  </code></pre>
  
  <p>The line that is throwing the error is this line:</p>
  
  <p><code>using (SLDocument theSpreadsheet = new SLDocument(filePath, "Sheet1"))</code></p>