(Classic ASP) List Files in a .zip
How to list files within a .zip Note: This example requires Chilkat v11.0.0 or greater.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set zip = Server.CreateObject("Chilkat.Zip")
success = zip.OpenZip("a.zip")
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>"
Response.End
End If
' Get the number of files and directories in the .zip
n = zip.NumEntries
set entry = Server.CreateObject("Chilkat.ZipEntry")
i = 0
Do While i < n
success = zip.EntryAt(i,entry)
If (entry.IsDirectory = 0) Then
' (the filename may include a path)
Response.Write "<pre>" & Server.HTMLEncode( entry.FileName) & "</pre>"
End If
i = i + 1
Loop
%>
</body>
</html>
|