![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Classic ASP) Unzip Text File to StringDemonstrates how to open a .zip and extract the 1st file (assuming it's a text file) to a string variable.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% ' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. ' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Zip") set zip = Server.CreateObject("Chilkat.Zip") success = zip.OpenZip("qa_data/zips/EC16100.zip") If (success <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>" Response.End End If ' Get the 1st file in the .zip ' entry is a Chilkat.ZipEntry Set entry = zip.GetEntryByIndex(0) If (zip.LastMethodSuccess <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( "No files in this zip.") & "</pre>" Response.End End If fileContents = entry.UnzipToString(0,"utf-8") Response.Write "<pre>" & Server.HTMLEncode( fileContents) & "</pre>" %> </body> </html> |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.