ASP.NET(vb.net) & Zip AddDirectory / Add file to Directory - This article how to example scripts ASP.NET Zip AddDirectory / Add file to Directory
ShotDev Focus:
- ASP.NET(vb.net) & Zip AddDirectory / Add file to Directory
Example
AspNetZipAddDirectory.aspx
<%@ Import Namespace="ICSharpCode.SharpZipLib.Zip"%> <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim MyZip As ZipFile MyZip = ZipFile.Create(Server.MapPath("MyZip/shotdev.zip")) With MyZip .BeginUpdate() .Add(Server.MapPath("myfiles1.txt"), "myfiles1.txt") .AddDirectory("MyDir") .Add(Server.MapPath("myfiles2.txt"), "MyDir/myfiles2.txt") .Add(Server.MapPath("myfiles3.txt"), "MyDir/myfiles3.txt") .CommitUpdate() End With MyZip.Close() Me.lblText.Text = "Zip Created <a href=MyZip/shotdev.zip>Click here</a> to Download" End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form runat="server"> <asp:Label id="lblText" runat="server"></asp:Label><br /> </form> </body> </html>
Screenshot