Posts Tagged ‘sharpziplib’

March 12, 2008 0

How to unzip files in .NET using SharpZipLib

By J in Uncategorized

SharpZipLib is a great open source library for handeling all kinds of gzip/zip compression/decompression. More Info – http://www.icsharpcode.net/OpenSource/SharpZipLib/
In the following example I’m passing the HtmlInputFile object directly into the ZipInputStream to decompress the PostedFile and save its contents on the server.

.
.
using System.IO;
using ICSharpCode.SharpZipLib.Zip
.
.
private void UnzipAndSave(HtmlInputFile objFileUpload)
{
ZipInputStream s = new ZipInputStream(objFileUpload.PostedFile.InputStream);

ZipEntry theEntry;
[...]

Tags: ,