Sample code for 30+ languages & platforms
Classic ASP

Unzip Text File to String

See more Zip Examples

Demonstrates how to open a .zip and extract the 1st file (assuming it's a text file) to a string variable.

Chilkat Classic ASP Downloads

Classic ASP
<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("qa_data/zips/EC16100.zip")
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>"
    Response.End
End If

' Get the 1st file in the .zip
set entry = Server.CreateObject("Chilkat.ZipEntry")
success = zip.EntryAt(0,entry)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>"
    Response.End
End If

fileContents = entry.UnzipToString(0,"utf-8")
Response.Write "<pre>" & Server.HTMLEncode( fileContents) & "</pre>"

%>
</body>
</html>