affordable web development services
| About Us | Services | Download | Order | Support | Subscribe to News Feed Follow us on Twitter Join us on Facebook |
 

ASP Zip Component v1.22 - Documentation

Table of Contents

Description

ASP Zip Component is ActiveX component offering high performance WinZip®, PKZIP®, and UNIX gzip compatible compression and decompression functionality. With its reach feature set this component is ideal for ASP applications or any other software capable of using ActiveX components. High quality of this product, ease of use, free setup support and unbeatable price make ASP Zip Component the great choice for responsible project managers.

Features

Compatibility

System Requirements

OS:

Web Server:

Installation Instructions

After receiving ASP Zip Component distribution package:

  1. Extract all files from zip file to temporary directory
  2. Run Setup.exe
  3. Follow instructions of the installer
  4. Test installation with one of the examples found in the archive

Installation Package Content

After running installation package with default options, setup program will create following files and folders on your hard drive:

    Binary Files
       c:\windows\system32\sczip.dll    - Softcomplex Zip DLL
       c:\windows\system32\stdvcl40.dll - Component support DLL
       c:\windows\system32\scziputl.dll - Component support DLL
       c:\windows\system32\cabinet.dll  - CAB archives support DLL
       c:\windows\system32\unacev2.dll  - ACE archives support DLL
       c:\windows\system32\unrar3.dll   - RAR archives support DLL
       
    Component Type Library
        c:\Program Files\SoftComplex\Zip Component\TypeLib\sczip.tlb
        
    Redistributable Files
        c:\Program Files\SoftComplex\Zip Component\Redist
        
    Documentation
        c:\Program Files\SoftComplex\Zip Component\Documentation
    
    Demo Files
        ASP    
            c:\Program Files\SoftComplex\Zip Component\Demo\ASP
            
        Microsoft Visual Studio 2005 Demo Projects
            c:\Program Files\SoftComplex\Zip Component\Demo\Microsoft Visual Studio 2005
            
        Microsoft Scripting Host Demo Files
            c:\Program Files\SoftComplex\Zip Component\Demo\Microsoft Scripting Host
            
        

WinZip® and SFX Compatibility Issues

In order to make compatible WinZip® or SFX archive you have to draw attention on following issues:

  1. If your result archive has any subfolder(s) and you set RecursionDirectories property to True you have to set KeepPaths property to true as well;
  2. If your result archive has any subfolder(s) and you set RelativePaths property to True you have to set KeepPaths property to true as well;

Objects Reference

Zip

Zip object

Syntax:

VBasic:

Set Zip = Server.CreateObject("SoftComplex.Zip")

JScript:

var Zip = Server.CreateObject("SoftComplex.Zip");
NameTypeDescription
 
Properties
ActionstringDefault Value: Replace

Allowed Values: Freshen (Is the same as Update but will not add to archive any new file. It will just replace old files with new ones), Replace, Update (Only new files will be added (replaced) in the archive)

This property has no meaning unless you Zip files
CommentstringZip archive comment
CompressModeintDefault Value: 6

The compression strength. Allowed values 0..9. 0 means that files will be stored as uncompressed. 9 means maximum compression

This property has no meaning unless you Zip files
CountintRead Only.

Returns count of items in the archive
DestDirectorystringThe path where unziped archive files will be saved

This property has no meaning unless you Unzip files
DiskCountintRead Only.

Return number of files in multi-files archive
ExcludeListstringsAdd filenames or wildcards of files that you donO`t want to be archived. You can use wildcards

This property has no meaning unless you Zip files
See Also: FileList, SkipList
FileAttributes (integer Index)wordRead Only.

Archived file system attributes
FileComment (integer Index)stringArchived file comment
FileCompressedSize (integer Index)intRead Only.

Archived file compressed size
FileCompressMethod (integer Index)intRead Only.

Archived file compressed method
FileCRC (integer Index)intRead Only.

Archived file CRC
FileDateTime (integer Index)datetimeArchived file system date and time stamp
FileDiskIndex (integer Index)intRead Only.

Disk number for specified compressed file. For single zip file always returns 1. For multi-files zip file returns actual archive file disk number.
See Also: DiskCount, MultiBlockSize, MultiMode, Split
FileFullName (integer Index)stringRead Only.

Returns file path and file name for specified archived file
FileListstringsAdd filenames or wildcards of files that you want add to archive. You can use wildcards

This property has no meaning unless you Zip files
See Also: ExcludeList, SkipList
FileName (integer Index)stringRead Only.

Returns file name for specified archived file
FilePathName (integer Index)stringRead Only.

Returns file path for specified archived file
FileSize (integer Index)intRead Only.

Returns archived file uncompressed size
See Also: FileCompressedSize
IsFileEncrypted (integer Index)boolRead Only.

Returns true if archived file is password encrypted
See Also: Password
IsFileOK (integer Index)boolRead Only.

Tests specified archived file and returns is it correct or not. Note, if zip file is password encrypted, set password first otherwise IsFileOk will return false.
See Also: Check, Fix, WrongZip, WrongZipMode
KeepAttributesboolDefault Value: True

Set to true if you want to have unzipped files with the same attributes as origianlly zipped files. Default false.

This property has no meaning unless you Zip files
KeepPathsboolDefault Value: False

If true then zip component will store original file path on zipping. If false it will store only filename.

This property has no meaning unless you Zip files
KeepVolumesboolDefault Value: False

This property has no meaning unless you Zip files
ModifiedboolRead Only.

Returns true if zip file comment was changed or some of archive file attributes were changed
See Also: Comment, FileAttributes, FileComment, FileName
MoveFilesboolDefault Value: False

If true then zip component will delete original files when zipping will be done.

This property has no meaning unless you Zip files
MultiBlockSizeintSize in bytes of block file of multi-files archive

This property has no meaning unless you Zip files
See Also: MultiMode, Split
MultiModestring Default Value: Solid

Allowed Values: Blocks, Solid

Determines is component in multi-files or single mode.
This may be useful, for instance, if you are creating a master installation disk set that will be copied to diskettes many times. The result of a Blocks zip file will be a series of files, the first with an extension of '.000', the second with an extension of '001' and so on. (Notice the last block is the one that should be used to open the archive.) These files are structurally the same as a Spanned Disks only all files are created in one destination directory instead of to separate disks.

This property has no meaning unless you Zip files
See Also: MultiBlockSize
OEMboolDefault Value: True

If true then zip component will apply OEM conversion to make it ascii compatible

This property has no meaning unless you Zip files
OverwriteModestringDefault Value: Always

Allowed Values: Always, Never, IfNewer, IfOlder

Determine what should be done if component tries to overwrite an existing file on unzipping process.

This property has no meaning unless you Unzip files
PasswordstringZip archive password
RecreateDirectoriesboolDefault Value: True

If true the directories will be created relative to DestDirectory property. If false zip component will try to unzip all archive files to DestDirectory that may cause some files that has the same names will be overwritten

This property has no meaning unless you Unzip files
RecursionDirectoriesboolDefault Value: False

If true all subdirectories will be recursive added to zip file

In order to WinZip® and SFX compatibility, when you set this property to True, component will set KeepPaths property to True as well

Note, if your zip archive has any subfolders and this property set to True but KeepPaths property is set to False, it will produce incompatible WinZip® or SFX archive.

This property has no meaning unless you Zip files
RelativePathsboolDefault Value: False

If true and you have set RootDirectory property, component will save relative paths instead of absolute paths.

In order to WinZip® and SFX compatibility, when you set this property to True, component will set KeepPaths property to True as well.

Note, if your zip archive has any subfolders and this property set to True but KeepPaths property is set to False, it will produce incompatible WinZip® or SFX archive.

This property has no meaning unless you Zip files
ReplaceReadOnlyboolDefault Value: True

If true files with readonly attribute will be replaced on unzipping

This property has no meaning unless you Unzip files
RootDirectorystringThe property determines where zip component should to start zipping if just file names or wildcards added to FileList property

When you set this property to any non empty value, component will set RecursionDirectories, RelativePaths and KeepPaths properties to True

This property has no meaning unless you Zip files
SaveEmptyDirectoriesboolDefault Value: False

If true the zip component will add even empty directories to archive.

This property has no meaning unless you Zip files
Selected (integer Index)boolSelect or unselect specified archive file.
See Also: ClearSelection,SelectedCount
SelectedCountintRead Only.

Returns the number of selected files
SFXDefaultOverwriteActionstringDefault Value: Prompt

Allowed Values: Prompt, Dont Overwrite, Overwrite

This value controls the behaviour of the SFX when a file to extract would be overwrite an existing file on disk

This property has no meaning unless you Zip files
SFXDialogTitlestringDefault Value: Softcomplex Self-Extractor

This value will be used as the title/caption of the SFX's dialog window

This property has no meaning unless you Zip files
SFXEnableAutoRunboolDefault Value: False

If true, the SFX will automatically start extraction of its archived files at startup

This property has no meaning unless you Zip files
SFXEnableFilesCustomSelectionboolDefault Value: True

If true, user can choose which files to extract

This property has no meaning unless you Zip files
SFXExtractionPathstringPath where SFX archive will be extracted to. If empty it will be extracted to the same folder where SFX archive is. If you set it to "><" (without quotes) the SFX will be extracted to system temp folder.

User will be able to change extraction path after SFX dialog appear.

This property has no meaning unless you Zip files
SFXForceDefaultOverwriteActionboolDefault Value: False

If true the user cannot change the default overwrite mode

This property has no meaning unless you Zip files
SFXRunCommandAfterExtractionstringThis string will be stored in the created self extracting archive (SFX).
After the SFX has extracted, the content of this string will be executed

You can use "><" (without quotes). It will be replaced with path of the folder where SFX extracted to.
You can use "|" (without quotes). The text after | symbol will be passed to command line as argument.

E.g.
  • ><setup.exe - will run setup.exe after SFX extracted
  • notepad.exe|><readme.txt - will run windows noteapd and pass readme.txt full path to it as argument
  • ><setup.exe|><setup.ini - will run setup.exe after SFX extracted and pass setup.ini full path to it as command line agrument.

This property has no meaning unless you Zip files
SFXStartupMessagestringIf this value is not empty SFX will show it on startup
ShortNamesModeboolDefault Value: False

If true stores file names in 8.3 format. Eg FILENAME.EXT
SizeintRead Only.

Returns zip archive size
SkipListstringsAdd filenames or wildcards of files that you want add to archive as uncompressed. You can use wildcards

This property has no meaning unless you Zip files
See Also: ExcludeList, FileList
SortModestringDetermine which order the component will use for sort archived files when open an archive
See Also: Sort
TempstringSets zip component temp folder. It is useful when you create a huge archive you can set temp to the same folder where zip file will be stored. So it will zip it faster.
Versionstring
WrongZipboolRead Only.

Returns true if zip file corrupted or has improper structure.
See Also: Check, Fix, WrongZipMode
WrongZipModestringRead Only.

If WrongZip is true this property returns an hit about of cause of problem
See Also: Check, Fix, WrongZip
ZipFileNamestringZip archive file name
Methods
Check()

bool Test the integrity of an entire archive.

Returns True if test passed successful.
See Also: IsFileOK
ClearSelection()

void Clears selection.
See Also: Selected, SelectedCount
Convert(string SourceFileName, string OutputArchiveType, string OutputFileName, string Password, bool RemoveSourceFile)

void Converts archive to an other format.

Arguments:

  • SourceFileName - The path to source archive file;
  • OutputArchiveType - Output archive file path. Allowed values - Cab, Lzh, Zip, Tar, TarGZip, Jar;
  • OutputFileName - Output file path. If empty the component will build it itself by replacing source file extention to appropriate one depending of OutputArchiveType value;
  • Password - If source file is password protected;
  • RemoveSourceFile - If you would like to remote source file after conversion set to true;
DeleteFile(string Path)

bool Deletes given file.

Returns True if file deleted successful.
DeleteFiles()

int Deletes archive files. If any file is selected the zip component will delete all selected files otherwise the component will try to delete files specified in the FileList property.

Returns count of deleted files.
See Also: ClearSelection, Selected, SelectedCount
DeleteFolder(string Path)

bool Deletes given folder.

Returns True if folder deleted successful.
Fix(string OutputFileName)

int Tries to fix an invalid zip archive.

Retruns count of files in result archive.
GetTempFileName(string Path, string Prefix, string Suffix)

string Generates unique file name in specified folder with given prefix and suffix and returns its path.
GetTempFolder(string Prefix, string Path)

string Creates an unique folder with given prefix in the system temp directory (or specified folder id Path is not empty) and returns its path.
GZipStream(ADODB.Stream InputStream, ADODB.Stream OutputStream)

void Compress input ADODB.Stream to output stream.
GZipTextToBuffer(string Text)

vb array of bytes Compress string uzing GZip algorithm.
New(string FileName)

void Creates new zip archive.
See Also: Open
Open(string FileName)

bool Opens existing zip archive.
See Also: New, Read
Read()

void Reads zip archive content.
Reset()

bool Resets component.
Save()

int Saves zip archive.

Returns count of files in the saved archive.
See Also: SaveAsSFX, SaveAsZip
SaveAsSFX(String SFXFileName)

int Saves zip archive as SFX. 

If SFXFileName is empty string ZipFileName will be used but extension will be changed to .exe
See Also: Save, SaveAsZip
Sort(String SortMode)

void Sorts archive files with given sort mode.
See Also: SortMode
Split()

void If MultiMode set to Block, splits archive to multiple files depending of MultiBlockSize size.
UnGZipBufferToText(vb array of bytes Buffer)

string Decompress string uzing GZip algorithm.

Arguments:

  • Buffer - Buffer for decompress is VB array of bytes;
UnGZipStream(ADODB.Stream InputStream, ADODB.Stream OutputStream)

void Decompress input ADODB.Stream to output stream.
UnSfx(string SourceFileName, string OutputFileName, bool RemoveSourceFile)

void Removes SFX stub from archive (converts SFX archive to native format)

Arguments:

  • SourceFileName - Source file path;
  • OutputFileName - Output file path;
  • RemoveSourceFile - If you would like to remote source file after conversion set to true;
Unzip()

int Unzips archive. If FileList is not empty only specified files will be extracted.

Returns count of unzipped files.
See Also: UnzipBufferToText, UnzipFileByIndexTo, UnzipFileByIndexToText, UnzipFileTo, UnzipFileToText, UnzipSelected, UnzipTo Code Demos: Extract files by using of UnzipTo method, Extract a file by using UnzipFileByIndexTo method, Extract a file by using UnzipFileTo method
UnzipBufferToText(vb array of bytes Buffer, string Password)

string Unzips buffer to text.
See Also: ZipTextToBuffer
UnzipFileByIndexTo(integer Index, string DestDirectory, string OverwriteMode)

bool Unzip single archive file to specified folder.

Returns True if file extraced successful.

Arguments:

  • Index;
  • DestDirectory;
  • OverwriteMode - Allowed Values: Always, Never, IfNewer, IfOlder;
See Also: UnzipFileTo
UnzipFileByIndexToText(integer Index)

string Unzips specified archive file and returns it content as text.
See Also: UnzipFileToText
UnzipFileTo(string FileName, string DestDirectory, string OverwriteMode)

bool Unzip single archive file to specified folder.

Returns True if file extracted successful.

Arguments:

  • FileName;
  • DestDirectory;
  • OverwriteMode - Allowed Values: Always, Never, IfNewer, IfOlder;
See Also: Unzip, UnzipFileByIndexTo
UnzipFileToText(String FileName)

string Unzips specified archive file and returns it content as text.
See Also: UnzipFileByIndexTo, UnzipFileTo
UnzipSelected()

int Unzip archive selected files .

Returns count of unzipped files.
See Also: Unzip, UnzipBufferToText, UnzipFileByIndexTo, UnzipFileByIndexToText, UnzipFileTo, UnzipFileToText, UnzipTo
UnzipStream(ADODB.Stream InputStream, ADODB.Stream OutputStream, string Password)

void Decompress input ADODB.Stream to output stream.
UnzipTo(string DestDirectory, string OverwriteMode)

int Unzips archive to specified folder. If FileList is not empty only specified files will be extracted.

Returns count of unzipped files.

Arguments:

  • DestDirectory;
  • OverwriteMode - Allowed Values: Always, Never, IfNewer, IfOlder;
See Also: UnzipBufferToText, UnzipFileByIndexTo, UnzipFileByIndexToText, UnzipFileTo, UnzipFileToText, UnzipSelected
UUDecode(string Text)

vb array of bytes Perform MIME UUDecode on given text.
See Also: UUEncode
UUEncode(vb array of bytes Text)

string Perform MIME UUEncode on given text.
See Also: UUDecode
ZipFilesTo(string SrcMask, string ZipFileName)

int Zips specified files to specified archive.

Returns count of zipped files.

This is a "single code line" method. It allways use default component properties. If you need to change some component properties before you zip files use "Zip.New( ... Zip.FileList.Add(... Zip.Save(.. " code.

See Also: ZipFolderTo
ZipFolderTo(string SrcDirectory, string ZipFileName)

int Zips specified folder to specified archive.

Returns count of zipped files.

This is a "single code line" method. It allways use default component properties. If you need to change some component properties before you zip files use "Zip.New( ... Zip.FileList.Add(... Zip.Save(.. " code.

See Also: ZipFilesTo
ZipStream(ADODB.Stream InputStream, ADODB.Stream OutputStream, string Password)

void Compress input ADODB.Stream to output stream.
ZipText(string FileName, string Text)

bool Add text to archive as file with given file name.
See Also: UnzipFileToText
ZipTextToBuffer(string Text, string Password)

vb array of bytes Zips text buffer.
See Also: UnzipBufferToText

Strings

Strings object

Strings object is Zip component helper object used internally for maintain string lists

NameTypeDescription
 
Properties
CountintegerRead Only.

Return number of items in string list
Item (integer Index)stringReturn item string
Methods
Add()

void Add an item to string list.
Clear()

void Clears string list.
Remove(integer Index)

void Deletes item from string list.

Arguments:

  • Index - Item index for delete;

Demos

Extract All Files

This demo shows how to use Zip Component for extract all archive files.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FilesCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")


	'read archive items
	Zip.Read 


	'set destination folder for unzip
	Zip.DestDirectory = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")



	'unzip zip archive
	FilesCount = Zip.Unzip 


Extract selected files

This demo shows how to use Zip Component for extract only selected files.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, I
	Dim FilesCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")


	'read archive items
	Zip.Read 


	'set destination folder for unzip
	Zip.DestDirectory = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")


	for I = 0 to Zip.Count-1
		'if file name contains ".html" token select file
		if InStr(1,Zip.FileName(I), ".html") then
			Zip.Selected(I) = True
		end if
	Next



	'unzip selected files
	FilesCount = Zip.UnzipSelected






Extract files by file list

This demo shows how to use Zip Component for extract only files that match specified mask.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FilesCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")


	'read archive items
	Zip.Read 


	'set destination folder for unzip
	Zip.DestDirectory = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")


	Zip.FileList.Add("*.jpg")
	Zip.FileList.Add("*.gif")



	'unzip files that match "*.jpg" and "*.gif" wildcards
	FilesCount = Zip.Unzip


Extract files by using of UnzipTo method

This demo shows how to extract zip files by using UnzipTo method.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, DestFolder
	Dim FilesCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")




	'destination folder for unzip
	DestFolder = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")


	'unzip zip archive
	FilesCount = Zip.UnzipTo(DestFolder, "")


Extract a file by using UnzipFileTo method

This demo shows how to extract a single archive file by using UnzipFileTo method.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, DestFolder
	Dim FileFound


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")




	'destination folder for unzip

	DestFolder = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")


	'unzip single file
	FileFound = Zip.UnzipFileTo("zipcomponent.html", DestFolder, "")


Extract a file by using UnzipFileByIndexTo method

This demo shows how to extract a single file by using UnzipFileByIndexTo method.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, DestFolder, FileIndex, I
	Dim FileFound


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")

	Zip.RecreateDirectories = True


	'destination folder for unzip

	DestFolder = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")


	FileIndex = -1

	'searching for first .js file
	for I = 0 to Zip.Count-1
		if InStr(Zip.FileName(I), ".js") > 0 then
			FileIndex = I
			exit for
		end if
	Next


	'if file found unziping .js file
	if FileIndex > -1 then 
		FileFound = Zip.UnzipFileByIndexTo(FileIndex, DestFolder, "")
	end if


Extract a file by using UnzipFileToText method

This demo shows how to extract a file content by using UnzipFileToText method.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, DestFolder
	Dim FileText


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open(Server.MapPath(".") & "\test.zip")





	'unzip archive file content into text variable
	FileText = Zip.UnzipFileToText("JavaScripts\Calculator\calculator.html")


	Response.Write "<br/><div class='message'><b>File text</b>:<pre>" & vbCRLF & FileText & vbCRLF & "</pre></div>"


Zip all files

This demo code shows how to zip files.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileList


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'create new zip file
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	'add files to archive
	Zip.FileList.Add("*.*")




	'save zip file
	FileCount = Zip.Save


Zip files by using ZipFolderTo method

This code shows how to zip files by using ZipFolderTo method.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'zip testfiles folder

	FileCount = Zip.ZipFolderTo(Server.MapPath(".") & "\TestFiles", FileName)

Zip files by using ZipFilesTo method

This demo code shows how zip files by using ZipFilesTo method.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'zip all gif files from testfiles folder
	FileCount = Zip.ZipFilesTo(Server.MapPath(".") & "\TestFiles\*.gif", FileName)


Zip files no recursion on directories

This code shows how to disable directories recursion on files zipping.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileList


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'create new zip file
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	Zip.RecursionDirectories = False


	'add files to archive
	Zip.FileList.Add("*.*")




	'save zip file
	Zip.Save





	'adding new text file to zip archive
	Zip.ZipText "TestTextFile.txt", "Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text"





	'extracting and writing to page archive text file contens
	Response.Write Zip.UnzipFileToText("TestTextFile.txt")

Zip/unzip text buffer demo

This demo shows how to zip or unzip text buffer

	Dim Zip
	Dim ZippedArrayOfBytes, ZBase64Str, Str
	Dim Values, I


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	Values = ""


	For I = 0 to 1000
		if Values <> "" then 
			Values = Values & ", "
		end if
		Values = Values & "value"  & CStr(I)
	Next

	ZippedArrayOfBytes = Zip.ZipTextToBuffer(Values, "")

	Str = Zip.UnZipBufferToText(ZippedArrayOfBytes, "")

	'Perform Base64 Encode on compressed text
	ZBase64Str = Zip.UUEncode(ZippedArrayOfBytes)


	Response.Write "<br/><div class='message'><b>Uncompressed Values Size:</b>" & CStr(Len(Values)) & "</div>" 
	Response.Write "<br/><div class='message'><b>Compressed Values Size:</b>" & CStr(UBound(ZippedArrayOfBytes)) & "</div>" 

	Response.Write "<br/><div class='message'><b>Uncompressed Values:</b>" & Values & "</div>" 
	Response.Write "<br/><div class='message'><b>Compressed and Base64 Encoded Values:</b>" & ZBase64Str & "</div>" 
	Response.Write "<br/><div class='message'><b>Compressed and then uncompressed values:</b>" & Str & "</div>" 


Compress/Decompress text buffer using GZip algorithm demo

This demo shows how to compress or decompress text buffer using GZip algorithm

	Dim Zip
	Dim ZippedArrayOfBytes, ZBase64Str, Str
	Dim Values, I


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	Values = ""


	For I = 0 to 1000
		if Values <> "" then 
			Values = Values & ", "
		end if
		Values = Values & "value"  & CStr(I)
	Next

	ZippedArrayOfBytes = Zip.GZipTextToBuffer(Values)

	Str = Zip.UnGZipBufferToText(ZippedArrayOfBytes)

	'Perform Base64 Encode on compressed text
	ZBase64Str = Zip.UUEncode(ZippedArrayOfBytes)


	Response.Write "<br/><div class='message'><b>Uncompressed Values Size:</b>" & CStr(Len(Values)) & "</div>" 
	Response.Write "<br/><div class='message'><b>Compressed Values Size:</b>" & CStr(UBound(ZippedArrayOfBytes)) & "</div>" 

	Response.Write "<br/><div class='message'><b>Uncompressed Values:</b>" & Values & "</div>" 
	Response.Write "<br/><div class='message'><b>Compressed and Base64 Encoded Values:</b>" & ZBase64Str & "</div>" 
	Response.Write "<br/><div class='message'><b>Compressed and then uncompressed values:</b>" & Str & "</div>" 


Compress/Decompress streams using GZip algorithm demo

This demo shows how to compress or decompress text or binary streams using GZip algorithm

	Dim Zip
	Dim InputStream, CompressedStream, DecompressedStream
	Dim InputText, DecompresedText


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	Set InputStream = Server.CreateObject("ADODB.Stream")
	Set CompressedStream = Server.CreateObject("ADODB.Stream")

	Set DecompressedStream = Server.CreateObject("ADODB.Stream")


	InputStream.Open

	InputStream.Type = 2 'Set type to Text


	InputText = "Some Text Some Text Some Text Some Text Some Text "


	InputStream.WriteText(InputText) 'Write Input Text to Stream
	Zip.GZipStream InputStream, CompressedStream 'Compress Stream


	Zip.UnGZipStream CompressedStream, DecompressedStream 'Decompress Stream 

	DecompressedStream.Position = 0 'Set position to begin of stream to change stream type
	DecompressedStream.Type = 2 'Set Stream Type to Text
	DecompressedStream.Charset = "x-ansi"


	DecompresedText = DecompressedStream.ReadText(DecompressedStream.Size) 'Read decompressed text from stream

	'close streams
	InputStream.Close
	CompressedStream.Close
	DecompressedStream.Close

Create SFX archive

This demo shows how to create self extracting archive.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileList, TempFolder, FileCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary folder
	TempFolder = Zip.GetTempFolder("my_temp_folder", Server.MapPath(".") & "\Temp")

	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(TempFolder, "test", ".zip")

	'create new zip archive
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	'add files to archive
	Zip.FileList.Add("*.*")




	'save sfx zip archive
	FileCount = Zip.SaveAsSFX("")


Create milti-files zip archive

This demo shows how to create milti-files zip archive.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, TempFolder


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary folder
	TempFolder = Zip.GetTempFolder("my_temp_folder", Server.MapPath(".") & "\Temp")


	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(TempFolder, "test", ".zip")

	'create new zip archive
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"

	Zip.MultiMode = "Blocks"
	Zip.MultiBlockSize = 30000 '30kb


	'add files to archive
	Zip.FileList.Add("*.*")




	'save multi blocks zip archive
	Zip.Save


Create custom SFX archive

This demo shows how to create custom self extracting archive.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, TempFolder, FileList


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary folder

	TempFolder = Zip.GetTempFolder("my_temp_folder", Server.MapPath(".") & "\Temp")


	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(TempFolder, "test", ".zip")

	'create new zip file
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	'add files to archive
	Zip.FileList.Add("*.*")



	Zip.SFXDialogTitle = "Custom Title"
	Zip.SFXEnableFilesCustomSelection = False

	'save sfx zip file
	FileCount = Zip.SaveAsSFX("")


Convert SFX to Zip

This demo shows how to convert a SFX archive to solid zip file.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'create temporary file name for output zip file 
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip") 

	'save sfx in native zip format
	Zip.UnSfx Server.MapPath(".") & "\test.exe", FileName, False

Spanning a zip file to user browser

This demo code shows how to span a zip file to user browser.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileList
	Dim objStream


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary file name for output zip file

	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'create new zip file
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	'ad files to archive
	Zip.FileList.Add("*.*")

	'save archive
	Zip.Save

	Response.AddHeader "Content-Length", CStr(Zip.Size)
	Response.ContentType = "application/x-zip-compressed"
	Response.AddHeader "Content-Disposition", "inline; filename=sample.zip"

	Set objStream = Server.CreateObject("ADODB.Stream")
	objStream.Open
	objStream.Type = 1 'adTypeBinary
	objStream.LoadFromFile FileName

	'send zip file to user browser
	Response.BinaryWrite objStream.Read

	objStream.Close
	Set objStream = Nothing

	'delete temp zip file
	Zip.DeleteFile(FileName)

	Response.End

Zip and Email demo

This demo shows how to create a zip archive and then send it by Email (Requires Softcomplex ASP Mail Component).
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, Email
	Dim FileName, FileList


	Set Zip = Server.CreateObject("SoftComplex.Zip")

	'create temporary file name for output zip file

	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'create new zip file
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	'add files to archive
	Zip.FileList.Add("*.*")


	'save zip archive
	Zip.Save



	'create mailer object
	Set Mailer = Server.CreateObject("SoftComplex.Email")

	Mailer.SmartHost = "localhost"
	Mailer.AddRecipient "Recipient Name", "[email protected]"

	'attach zip file to email message
	Mailer.AddAttachment FileName

	Mailer.Subject = "Test"
	Mailer.Body = "Message Body"

	'send email message and check send result
	if Mailer.Send = 0 then 
		Response.Write "<p>Result: Ok</p>"
	else
		'Report Error
		Response.Write "<p>Result: Error (" + Mailer.Response + ")</p>"
	end if

	'delete temporary zip file
	Zip.DeleteFile(FileName)

Check zip file integrity

This demo shows how to test a zip file integrity

	Dim Zip, I
	Dim FilesCount, CheckResult, FileName


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'open zip file
	Zip.Open (Server.MapPath(".") & "\testbroken.zip")

	'create temporary file name for output zip file

	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")


	'check zip file
	CheckResult = Zip.Check


	Response.Write "<br/><div class='message'>Is Archive OK: " & CheckResult & "</div>"
	if not CheckResult then 
		Response.Write "<br/><div class='message'>Possible Reason: " & Zip.WrongZipMode & "</div>" 
	end if



	Response.Write "<br/><div class='message'><b>Archive Content</b></div>"


	Response.Write "<table cellpadding='3'>"
	Response.Write "<tr><th>Type</th><th>Attributes</th><th>File Date</th><th>Path</th><th>Name</th><th>Is File Ok</th></tr>"


	for I = 0 to Zip.Count-1
		Response.Write "<tr>"
		if Zip.FileAttributes(I) and 16 then
			Response.Write "<td> folder </td>"
		else
			Response.Write "<td>  </td>"
		end if
		Response.Write "<td>" & FileAttributesToString(Zip.FileAttributes(I)) & "</td>"
		Response.Write "<td>" & Zip.FileDateTime(I) & "</td>"
		Response.Write "<td>" & Zip.FilePathName(I) & "</td>"
		Response.Write "<td>" & Zip.FileName(I) & "</td>"
	

		if Zip.IsFileOK(I) then
			Response.Write "<td>OK</td>"
		else
			Response.Write "<td><b><font color='red'>Broken</font></b></td>"
		end if
	

		Response.Write "</tr>"		

	Next


	Response.Write "</table>"

Fix a zip file

This demo shows how to fix a broken zip file.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip, I
	Dim FilesCount, FileName, CheckResult


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'open broken zip file
	Zip.Open Server.MapPath(".") & "\testbroken.zip"


	'fix zip file
	I = Zip.Fix(FileName)

	'reset zip component
	Zip.Reset


	'open output zip file
	Zip.Open FileName


	'read archive items
	CheckResult = Zip.Check
	Response.Write "<br/><div class='message'><b>Fixed Archive Info</b></div>" 
	Response.Write "<br/><div class='message'>Is Archive OK: " & CheckResult & "</div>" 
	if not CheckResult then
		Response.Write "<br/><div class='message'>Possible Reason: " & Zip.WrongZipMode & "</div>" 
	end if


	Response.Write "<br/><div class='message'><b>Fixed Archive Content</b></div>" 


	Response.Write "<table cellpadding='3'>"
	Response.Write "<tr><th>Type</th><th>Attributes</th><th>File Date</th><th>Path</th><th>Name</th><th>Is File Ok</th></tr>"


	for I = 0 to Zip.Count-1
		Response.Write "<tr>"
		if Zip.FileAttributes(I) and 16 then
			Response.Write "<td> folder </td>"
		else
			Response.Write "<td>  </td>"
		end if
		Response.Write "<td>" & FileAttributesToString(Zip.FileAttributes(I)) & "</td>"
		Response.Write "<td>" & Zip.FileDateTime(I) & "</td>"
		Response.Write "<td>" & Zip.FilePathName(I) & "</td>"
		Response.Write "<td>" & Zip.FileName(I) & "</td>"
	

		if Zip.IsFileOK(I) then
			Response.Write "<td>OK</td>"
		else
			Response.Write "<td><b><font color='red'>Broken</font></b></td>"
		end if
	

		Response.Write "</tr>"		

	Next


	Response.Write "</table>"


Convert ZIP archive to CAB

This demo shows how to convert existing zip archive to cab archive.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FileName2, FileList


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'create temporary file name for output zip file
	FileName = Zip.GetTempFileName(Server.MapPath(".") & "\Temp", "test", ".zip")

	'create temporary file name for output cab file
	FileName2 = Replace(FileName, ".zip", ".cab")

	'create new zip file
	Zip.New(FileName)


	'set root folder
	Zip.RootDirectory = Server.MapPath(".") & "\TestFiles"


	'add files to archive
	Zip.FileList.Add("*.*")

	'save zip archive
	FileCount = Zip.Save


	'convert zip archive to cab and delete source zip file
	Zip.Convert FileName, "Cab", FileName2, "", True


Convert ARJ archive to ZIP

This demo shows how to convert existing ARJ archive to ZIP archive.
(Note this demo code uses Zip.GetTempFolder/Zip.GetTempFileName just for demo purpose for create unique temp folder/temp file. If you copy and paste this code use actual folder/file paths)

	Dim Zip
	Dim FileName, FilesCount


	Set Zip = Server.CreateObject("SoftComplex.Zip")


	'Convert arj archive to zip archive
	Zip.Convert Server.MapPath(".") & "\test.arj", "Zip", FileName, "", False


	'open zip file
	Zip.Open(FileName)


	'read archive items
	Zip.Read 


	'set destination folder for unzip
	Zip.DestDirectory = Zip.GetTempFolder("my_unzip_folder", Server.MapPath(".") & "\Temp")



	'unziping zip archive
	FilesCount = Zip.Unzip 

Terms and Conditions

Single Server License

One single server ASP Zip Component license gives the right to use one installation of the component. Component can be used by unlimited number of sites/domains hosted on the server.

Single Organization License

One single organization ASP Zip Component license gives the right to use unlimited installations of the component within single organization network.

Developer License

Developer license gives the right to include unlimited number of ASP Zip Component instances in the products of license owner. Such kind of license is obtained automatically by those who have 5 or more single licenses of any type above.

Discounts

After license order customers are offered special (significantly discounted) prices for other products of SoftComplex.

Usage

As owner of the ASP Zip Component license You are allowed to use the component in any possible way in Internet (public), Intranet (corporate), however You are strictly NOT allowed (unless specifically authorized by SoftComplex.com) to:

Technical Support

You are entitled to free product upgrades and technical support for at least one year from the date of purchase. Technical support includes answers to script related questions via e-mail and/or Internet instant messaging services.

Violations of Terms and Conditions

Should you violate these Terms and Conditions or any other rights of SoftComplex Inc., SoftComplex Inc. reserves the right to pursue any and all legal and equitable remedies against you without limitation.

Links and References