Provides additional information to the cfzip tag.

The cfzipparamtag is always a child tag of the cfzip tag.


ColdFusion 11: Added 2 new attributes, password and encryptionalgorithm.

ColdFusion 8: Added this tag.



charset = "encoding type" 
content = "variable name" 
entryPath = "full pathname" 
filter = "file filter" 
prefix = "string" 
recurse = "yes|no" 
source = "source directory" 
encryptionAlgorithm = "standard|AES-128|AES-256" 
password = "password string">

You can specify this tag’s attributes in anattributeCollectionattribute whose value is a structure. Specify the structure name in theattributeCollectionattribute and use the tag’s attribute names as structure keys.

cfscript equivalent of the syntax

cfzipparam(charset = "encoding type", content = "variable name", entryPath = "full pathname", filter = "file filter", prefix = "string", recurse = "yes|no", source = "source directory", encryptionAlgorithm = "standard|AES-128|AES-256", password = "password string")

See also








default encoding of the host machine

Converts string content into binary data before putting it into a ZIP or JAR file. Used only whencfzip action="zip"and thecfzipparamcontent is a string.

Examples of character sets:


  • JIS

  • RFC1345

  • UTF-16





Content written to the ZIP or JAR entry. Used only whencfzip action="zip".

Valid content data types arebinaryandstring. If you specify thecontentattribute, specify theentrypathattribute.




Pathname used:


  • Forcfzip action="zip", it is the entry path used. This is valid only when thesourceis a file. The entry path creates a subdirectory in the ZIP or JAR file.

  • Forcfzip action="unzip", it is the pathname to unzip.

  • Forcfzip action="delete", it is the pathname to delete from the ZIP or JAR file.





File filter applied to the action. For example, for thezipaction, all the files in thesourcedirectory that match the filter are zipped.




String added as a prefix to the ZIP or JAR entry. Used only whencfzip action="zip".




Include the directory to be zipped, unzipped, or deleted, as specified by thecfzipparent tag.




Source directory or file. Used only whencfzip action="zip".

Specified files are added to the ZIP or JAR file:


  • If you specifysourceattribute for thecfziptag, thecfzipparam sourceis relative to it.

  • If you do not specify asourceattribute for thecfziptag, thecfzipparam sourcemust be an absolute pathname.


encryptionAlgorithm Optional  

The encryption algorithm to use for compression. The following options are valid:

  • AES-256
  • AES-128
  • Standard

If the attibutes are specified in the CFZip tag, they can be inherited or overridden by the corresponding attributes in the CFZipparam tag.

If only password is provided, the default encryptionAlgorithm will be AES 256-bit.

If used with a directory, all files in that directory will be protected with the same password/encryption.
password read readBinary zip unzip Required, if encryptionAlgorithm is specified The password to protect the archive.


Use thecfzipparamtag with thecfziptag to zip, extract, or delete multiple files or directories. For example, to zip multiple directories, specify acfzipparamtag for each source directory.


Example 1

<cfzip file="c:\util.jar" source="c:\myproj\classes">
<cfzipparam source="com\abc\util" filter="*.class">
<cfzipparam source="com\abc\io" filter="*.class, *.properties">

Example 2

<cfzip file="e:\work\test.jar" action="zip">
<cfzipparam source="c:\temp\abc.txt" prefix="com\abc">
<cfzipparam source="c:\src\classes" recurse="yes"
filter="*.class,*.properties" prefix="classes">
<cfzipparam source="c:\src\Manifest.MF" entrypath="META-INF\MANIFEST">

Example 3

<!--- Create a variable that specifies a time-out period. --->
<cfset myDoc="<system-config><timeout>1500</timeout><pool-max-size>30
<!--- Zip the file. --->
<cfzip file="e:\work\" action="zip">
<cfzipparam source="c:\src\Manifest.MF" entrypath="META-INF\MANIFEST">
<cfzipparam content="#myDoc#" entrypath="system-config.xml">

Example 4

<cfzip file="e:\work\admin.jar">
<cfzipparam source="c:\src\classes" recurse="yes"
<cfzipparam source="c:\src\Manifest.MF" entrypath="META-INF\MANIFEST">

Example 5

The following example shows how to zip multiple image files chosen from a form and e-mail the ZIP file to the person requesting the images.

The first ColdFusion page populates a pop-up menu with the names of artists generated from a database query:

<h3>Select the images</h3>
<p>Please choose the images you would like sent to you.</p>
<!--- Create the ColdFusion form to select the images. --->
<cfform action="zip2_action.cfm" method="post"
<td><img src="../cfdocs/images/artgallery/elecia01.jpg"/><br/>
<cfinput type="checkbox" name="ck1" Value=1>Cube</td>
<td><img src="../cfdocs/images/artgallery/elecia02.jpg"/><br/>
<cfinput type="checkbox" name="ck2" Value=1>Pentagon</td>
<td><img src="../cfdocs/images/artgallery/elecia03.jpg"/><br/>
<cfinput type="checkbox" name="ck3" Value=1>Surfer Dude</td>
<td><img src="../cfdocs/images/artgallery/elecia04.jpg"/><br/>
<cfinput type="checkbox" name="ck4" Value=1>Surfer Girl</td></tr>
<tr><td><cfinput type = "Submit" name = "OK" label="OK"></td></tr>

The first action page zips the files selected from the form, and writes the ZIP file to the hard drive. Also, it includes a form to e-mail the ZIP file:

<cfset thisDir = ExpandPath(".")>

<!--- Create a ZIP file based on the selections from the form. Use the cfzipparam tag to specify the source for each check box selection. --->
<cfzip file="c:\" source="#thisDir#" action="zip" overwrite="yes">
<cfif IsDefined("form.ck1")>
<cfzipparam source="../cfdocs/images/artgallery/elecia01.jpg">
<cfif IsDefined("form.ck2")>
<cfzipparam source="../cfdocs/images/artgallery/elecia02.jpg">
<cfif IsDefined("form.ck3")>
<cfzipparam source="../cfdocs/images/artgallery/elecia03.jpg">
<cfif IsDefined("form.ck4")>
<cfzipparam source="../cfdocs/images/artgallery/elecia04.jpg">
<h3>Mail the ZIP File</h3>
<p>Please enter your e-mail address so we can send you the ZIP file as an attachment.</p>
<cfif IsDefined("form.mailto")>
<cfif form.mailto is not "" >
<cfmail from="" to="#form.mailto#"
subject="see zipped attachment">
The images you requested are enclosed in a ZIP file.
<cfmailparam file="#thisDir#/">
<cfform action = "zipArt_action2.cfm" method="post">
Your e-mail address: <cfinput type = "Text" name = "MailTo">
<!--- Specify the required field. --->
<cfinput type = "hidden" name = "MailTo_required"
value = "You must enter your email address">
<cfinput type = "hidden" name="zipPath" value = "c:\">
<p><cfinput type = "Submit" name = "OK" label="Mail">

The second action page mails the ZIP file as an attachment:

<h3>Mail the ZIP file</h3> 
<p>Your file has been mailed to you.</p> 
<cfset eMail="#form.MailTo#"> 
<cfset zipPath="#form.zipPath#"> 
<cfmail from="" to="#eMail#" 
subject="see zipped attachment"> 
The images you requested are enclosed in a ZIP file. 
<cfmailparam file="#zipPath#"> 

To protect a zip archive with a password:

<cfzip action="zip" file="<zip_file_path>" source="<source_dir_path>" password="admin" encryptionAlgorithm="AES-128" />
<cfzip action="unzip" file="<zip_file_path>" destination="<dest_dir_path>" >
<cfzipparam entrypath="sample.txt" password="admin" encryptionAlgorithm="AES-128">
Adobe logo

Sign in to your account