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.
OS:
Web Server:
After receiving ASP Zip Component distribution package:
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
In order to make compatible WinZip® or SFX archive you have to draw attention on following issues:
Zip object
VBasic:
Set Zip = Server.CreateObject("SoftComplex.Zip")
JScript:
var Zip = Server.CreateObject("SoftComplex.Zip");
| Name | Type | Description |
|---|---|---|
| Properties | ||
| Action | string | Default 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 |
| Comment | string | Zip archive comment |
| CompressMode | int | Default 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 |
| Count | int | Read Only. Returns count of items in the archive |
| DestDirectory | string | The path where unziped archive files will be saved This property has no meaning unless you Unzip files |
| DiskCount | int | Read Only. Return number of files in multi-files archive |
| ExcludeList | strings | Add 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 |
| FileAttributes (integer Index) | word | Read Only. Archived file system attributes |
| FileComment (integer Index) | string | Archived file comment |
| FileCompressedSize (integer Index) | int | Read Only. Archived file compressed size |
| FileCompressMethod (integer Index) | int | Read Only. Archived file compressed method |
| FileCRC (integer Index) | int | Read Only. Archived file CRC |
| FileDateTime (integer Index) | datetime | Archived file system date and time stamp |
| FileDiskIndex (integer Index) | int | Read 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. |
| FileFullName (integer Index) | string | Read Only. Returns file path and file name for specified archived file |
| FileList | strings | Add 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) | string | Read Only. Returns file name for specified archived file |
| FilePathName (integer Index) | string | Read Only. Returns file path for specified archived file |
| FileSize (integer Index) | int | Read Only. Returns archived file uncompressed size See Also: FileCompressedSize |
| IsFileEncrypted (integer Index) | bool | Read Only. Returns true if archived file is password encrypted See Also: Password
|
| IsFileOK (integer Index) | bool | Read 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. |
| KeepAttributes | bool | Default 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 |
| KeepPaths | bool | Default 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 |
| KeepVolumes | bool | Default Value: False This property has no meaning unless you Zip files |
| Modified | bool | Read Only. Returns true if zip file comment was changed or some of archive file attributes were changed |
| MoveFiles | bool | Default 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 |
| MultiBlockSize | int | Size in bytes of block file of multi-files archive
This property has no meaning unless you Zip files |
| MultiMode | string | 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
|
| OEM | bool | Default 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 |
| OverwriteMode | string | Default 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 |
| Password | string | Zip archive password |
| RecreateDirectories | bool | Default 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 |
| RecursionDirectories | bool | Default 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 |
| RelativePaths | bool | Default 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 |
| ReplaceReadOnly | bool | Default Value: True If true files with readonly attribute will be replaced on unzipping This property has no meaning unless you Unzip files |
| RootDirectory | string | The 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 |
| SaveEmptyDirectories | bool | Default 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) | bool | Select or unselect specified archive file. See Also: ClearSelection,SelectedCount |
| SelectedCount | int | Read Only. Returns the number of selected files |
| SFXDefaultOverwriteAction | string | Default 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 |
| SFXDialogTitle | string | Default 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 |
| SFXEnableAutoRun | bool | Default 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 |
| SFXEnableFilesCustomSelection | bool | Default Value: True If true, user can choose which files to extract This property has no meaning unless you Zip files |
| SFXExtractionPath | string | Path 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 |
| SFXForceDefaultOverwriteAction | bool | Default Value: False If true the user cannot change the default overwrite mode This property has no meaning unless you Zip files |
| SFXRunCommandAfterExtraction | string | This 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.
This property has no meaning unless you Zip files |
| SFXStartupMessage | string | If this value is not empty SFX will show it on startup |
| ShortNamesMode | bool | Default Value: False If true stores file names in 8.3 format. Eg FILENAME.EXT |
| Size | int | Read Only. Returns zip archive size |
| SkipList | strings | Add 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 |
| SortMode | string | Determine which order the component will use for sort archived files when open an archive
See Also: Sort |
| Temp | string | Sets 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. |
| Version | string | |
| WrongZip | bool | Read Only. Returns true if zip file corrupted or has improper structure. |
| WrongZipMode | string | Read Only. If WrongZip is true this property returns an hit about of cause of problem |
| ZipFileName | string | Zip 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:
|
| 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. |
| 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. |
| Read() | void | Reads zip archive content. |
| Reset() | bool | Resets component. |
| Save() | int | Saves zip archive.
Returns count of files in the saved archive. |
| 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 |
| 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:
|
| 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:
|
| Unzip() | int | Unzips archive. If FileList is not empty only specified files will be extracted.
Returns count of unzipped files. |
| 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:
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:
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. |
| 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:
|
| 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 object
Strings object is Zip component helper object used internally for maintain string lists
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
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
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
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, "")
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, "")
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
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>"
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
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)
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)
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")
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>"
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>"
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
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("")
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
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("")
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
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
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", "recipient@server"
'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)
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>"
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>"
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
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
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.
One single organization ASP Zip Component license gives the right to use unlimited installations of the component within single organization network.
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.
After license order customers are offered special (significantly discounted) prices for other products of SoftComplex.
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:
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.
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.