Home Site Map Buy Email
AdvSMTP
AdvIMAP4
AdvPOP3
AdvFile
AdvZIP
AdvGraphGenerator
AdvLDAP
AdvHTTP
AdvDSN
AdvDirectory
AdvRegistry
AdvMX
ASP Components >> AdvZIP
see also CF_ZIP
Download | Buy
AdvZIP

AdvZip component is a complete compression solution for any Windows based application or server. It includes standard Zip and Unzip functions. Access to the component can also be turned on at website basis like all other ASPFusion components. The component provides these operations.

Zip more than one file.
Zip folder.
Add a file or folder to existing zip file.
Unzip a given zip file, save all files on disk and return information about each file.
Get listing for all files and folders, exist in given zip file.
Unzip a single file from given zip file.
Delete a single file from given zip file.
Capable to handle password protected archives.
The component has capability to detect and handle self-extracting archives.

ASPFusion also provides ColdFusion custom tag CF_ZIP written on AdvZIP component. This helps coldfusion developers in making a better understanding, in case they are using AdvZIP component.

Sample code for C++, ASP and CF is provided with the component.

Example (ASP):

<% set Obj = Server.CreateObject("AdvZIP.ZIP") %>

Example (ColdFusion):

<CFOBJECT Class="AdvZIP.ZIP" Action="Create" Name="Obj">

AdvZIP Properties

Property Description
CreateNew This is the flag used to inform AdvZIP component whether to create new zip file in case zip file already exists. Valid values are

TRUE (default) if this flag is set as TRUE then component will always create new zip file in case file already exists
FALSE if it is set as FALSE then component will not create new file, will add to existing zip file in case file already exists

Example (ASP):
<% Obj.CreateNew = false %>

Example (ColdFusion):
<CFSET Obj.CreateNew = false>
ErrorReason Reports any error that occurred during the request.

Example (ASP):
<% if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error Occurred
end if %>

Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
        <CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
        <CFOUTPUT>No Error Occurred</CFOUTPUT>
</CFIF>
IsError Returns 1 if any error occurred during the request otherwise 0.

Example (ASP):
<% if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error Occurred
end if %>

Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
        <CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
        <CFOUTPUT>No Error Occurred</CFOUTPUT>
</CFIF>
NameConflict This flag is used to handle the situation if the file name conflicts with the name of another file that already exists in the directory. Valid values are

MakeUnique component will save file with unique file name if file with same name already exists and will return its new name
OverWrite (default) component will overwrite to existing file if file with same name already exists

Example (ASP):
<% Obj.NameConflict = "makeunique" %>

Example (ColdFusion):
<CFSET Obj.NameConflict = "makeunique">
Password This property is used to specify password to handle password protected archives. If not specified then no encryption or decryption takes place.

Example (ASP):
<% Obj.Password = "my password" %>

Example (ColdFusion):
<CFSET Obj.Password = "my password">
SubFolders This flag is used to inform AdvZIP component whether to add subfolders automatically along with files. Valid values are

TRUE (default) if this value is set as TRUE then component will add subfolders to zip file automatically
FALSE if this value is set as FALSE then component will zip files only and will ignore all subfolders

Example (ASP):
<% Obj.SubFolders = false %>

Example (ColdFusion):
<CFSET Obj.SubFolders = false>
TargetPath This is target folder path where all files will be unzipped.

Example (ASP):
<% Obj.TargetPath = "c:\myfolder" %>

Example (ColdFusion):
<CFSET Obj.TargetPath = "c:\myfolder">
UsePath This flag is used to inform AdvZIP component whether to zip given files using their complete path or using their names only. This property is ignored in case of adding folders to zip. Valid values are

TRUE (default) in case of TRUE component will zip files using their complete path
FALSE if it is set as FALSE then component will zip files using their names only

Example (ASP):
<% Obj.UsePath = false %>

Example (ColdFusion):
<CFSET Obj.UsePath = false>
ZipFile This is the zip file on which all operations will be performed.

Example (ASP):
<% Obj.ZipFile = "c:\myfolder\myfile.zip" %>

Example (ColdFusion):
<CFSET Obj.ZipFile = "c:\myfolder\myfile.zip">

AdvZIP Methods

Method Parameter Return Value Description
Add 1. File Path None Add a file to zip.

Example (ASP):
<% Obj.Add("c:\myfolder\myfile.exe") %>

Example (ColdFusion):
<CFSET Obj.Add("c:\myfolder\myfile.exe")>
AddFolder 1. Folder Path None Add folder to zip.

Example (ASP):
<% Obj.AddFolder("c:\myfolder") %>

Example (ColdFusion):
<CFSET Obj.AddFolder("c:\myfolder")>
Delete None None Delete a file from existing zip file, file to be delete can be specified using Add method.

Example (ASP):
<% Obj.Delete() %>

Example (ColdFusion):
<CFSET Obj.Delete()>
Extract None None Extract a file from existing zip file, file to be extract can be specified using Add method.

Example (ASP):
<% Obj.Extract() %>

Example (ColdFusion):
<CFSET Obj.Extract()>
List None Array of objects Return listing of all files and folders exist in given zip file.

Example (ASP):
<% set Result = Obj.List()
for each Member in Result
        Response.Write Member.Name
        Response.Write Member.Type
        Response.Write Member.Size
        Response.Write Member.PasswordRequired
next
set Result = nothing %>

Example (ColdFusion):
<CFSET Result = Obj.List()>
<CFLOOP Collection="#Result#" Item="Member">
        <CFOUTPUT>
               #Member.Name#
               #Member.Type#
               #Member.Size#
               #Member.PasswordRequired#
        </CFOUTPUT>
</CFLOOP>

WHERE in List collection
Name contains name of the file or directory.
Type contains type, whether it is a file or directory.
Size contains size of the file.
PasswordRequired contains value Yes or No, whether the file is password protected or not.

UnZip None Array of objects Unzip given zip file at given path specified using method TargetPath and return listing of all unzipped files and folders.

Example (ASP):
<% set Result = Obj.UnZip()
for each Member in Result
        Response.Write Member.Name
        Response.Write Member.SavedName
        Response.Write Member.Type
        Response.Write Member.Size
        Response.Write Member.PasswordRequired
next
set Result = nothing %>

Example (ColdFusion):
<CFSET Result = Obj.UnZip()>
<CFLOOP Collection="#Result#" Item="Member">
        <CFOUTPUT>
               #Member.Name#
               #Member.SavedName#
               #Member.Type#
               #Member.Size#
               #Member.PasswordRequired#
        </CFOUTPUT>
</CFLOOP>

WHERE in UnZip collection
Name contains name of the file or directory.
SavedName contains name of the file or directory if it is saved with some other file name.
Type contains type, whether it is a file or directory.
Size contains size of the file.
PasswordRequired contains value Yes or No, whether the file is password protected or not.

Zip None None Zip given files and folders.

Example (ASP):
<% Obj.Zip() %>

Example (ColdFusion):
<CFSET Obj.Zip()>