Classic ASP
Classic ASP
Create Password Protected Zip containing a Single File.
See more Zip Examples
Create a password-protected .zip containing a single file. (This uses the older Zip 2.0 encryption scheme, which is weaker and not as secure as AES encryption, which Chilkat Zip also supports.)Chilkat Classic ASP Downloads
<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.NewZip("test.zip")
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>"
Response.End
End If
zip.SetPassword "secret"
zip.PasswordProtect = 1
saveExtraPath = 0
success = zip.AddFile("/temp/hamlet.xml",saveExtraPath)
success = zip.WriteZipAndClose()
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Zip Created!") & "</pre>"
%>
</body>
</html>