(一). 实现功能
对文件及目录的压缩及解压功能
(二). 运行图片示例
(三).代码
1. 压缩类
1
2. 前台页面代码
1
<body>
2
<form id="form1" runat="server">
3
<div>
4
<asp:Label ID="Label1" runat="server" BackColor="#C0C0FF" Font-Size="XX-Large"
5
Height="44px" Text="压缩文件/文件夹示例" Width="366px"></asp:Label>
6
<asp:Panel ID="Panel1" runat="server" Height="1px" Width="369px" BackColor="#FFFFC0">
7
<table width="100%" height="100%">
8
<tr>
9
<td style="width: 3px" valign="top">
10
<asp:Label ID="lbDisplay" runat="server" Text="压缩目录(from/to):" Width="153px"></asp:Label><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
11
<br />
12
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
13
<br />
14
<asp:Button ID="btZipDictory" runat="server" OnClick="btZipDictory_Click" Text="压缩目录" /><br />
15
</td>
16
<td style="width: 4px" valign="middle">
17
<asp:Label ID="Label2" runat="server" Text="解压目录(from/to):" Width="154px"></asp:Label>
18
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
19
<br />
20
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
21
<br />
22
<asp:Button ID="btUnZipDictory" runat="server" Text="解压目录" OnClick="btUnZipDictory_Click" /><br />
23
</td>
24
</tr>
25
<tr>
26
<td style="width: 3px; height: 150px" valign="top">
27
<asp:Label ID="Label3" runat="server" Text="压缩文件(from/to):" Width="153px"></asp:Label>
28
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
29
<br />
30
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
31
<br />
32
<asp:Button ID="btZipFile" runat="server" Text="压缩文件" OnClick="btZipFile_Click" /><br />
33
</td>
34
<td style="width: 4px; height: 150px" valign="top">
35
<asp:Label ID="Label4" runat="server" Text="解压文件(from/to):" Width="154px"></asp:Label>
36
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
37
<br />
38
<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
39
<br />
40
<asp:Button ID="btUnZipFile" runat="server" Text="解压文件" OnClick="btUnZipFile_Click" /><br />
41
</td>
42
43
</tr>
44
45
</table>
46
<asp:Label ID="lbMessage" runat="server" Width="368px"></asp:Label><br />
47
<br />
48
</asp:Panel>
49
50
</div>
51
</form>
52
</body>
53
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
3. 后台页面代码
1
public partial class _Default : System.Web.UI.Page
2
2
(四). 示例代码下载