Unzip (Extract) a Zip file from Folder using C# .Net

Last Reply on Mar 17, 2015 02:15 AM By Mudassar

Posted on Mar 17, 2015 02:15 AM

Hello, I am using this article

http://www.aspsnippets.com/Articles/Upload-Unzip-and-Extract-contents-Zip-Archive-file-in-ASPNet-using-C-and-VBNet.aspx

My question is on how to unzip file without the file upload, since there's no fieupload, the file will manually code behind.

For example:

file.zip, then it will be unzip in the folder files.

The file.zip is fixed in code behind.

Thanks

Posted on Mar 17, 2015 02:15 AM

This way

protected void Upload(object sender, EventArgs e)
{
    string extractPath = Server.MapPath("~/Files/");
    using (ZipFile zip = ZipFile.Read(Server.MapPath("~/Files/Test.zip")))
    {
        zip.ExtractAll(extractPath, ExtractExistingFileAction.DoNotOverwrite);
        GridView1.DataSource = zip.Entries;
        GridView1.DataBind();
    }
}

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html