ZipArchive gives Unexpected end of data corrupted error

Move zipStream.ToArray() outside of the zipArchive using.

The reason for your problem is that the stream is buffered. There’s a few ways to deal wtih it:

  • You can set the stream’s AutoFlush property to true.
  • You can manually call .Flush() on the stream.

Or, since it’s MemoryStream and you’re using .ToArray(), you can simply allow the stream to be Closed/Disposed first (which we’ve done by moving it outside the using).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)