Unzip an Encrypted Zip
Demonstrates how to open an encrypted .zip archive and unzip.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set zip = Server.CreateObject("Chilkat_9_5_0.Zip")
' Any string unlocks the component for the 1st 30-days.
success = zip.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode(zip.LastErrorText) & "</pre>"
End If
' Set the password required for decrypting.
zip.DecryptPassword = "myPassword"
success = zip.OpenZip("encrypted.zip")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode(zip.LastErrorText) & "</pre>"
End If
' Returns the number of files and directories unzipped.
unzipCount = zip.Unzip("c:/unzipDir")
If (unzipCount < 0) Then
Response.Write "<pre>" & Server.HTMLEncode(zip.LastErrorText) & "</pre>"
Else
Response.Write "<pre>" & Server.HTMLEncode("Success!") & "</pre>"
End If
%>
</body>
</html>
|