– Common Function Library Project

WDDXFileWrite(file, var)

Last updated October 15, 2002


Nathan Dintenfass

Version: 2 | Requires: CF6 | Library: CFMLLib

Ever get annoyed at the couple of lines you are always writing to store and retrieve WDDX in flat files? Then this is the UDF for you. Also see it's sister UDF WDDXFileRead().

Return Values:
Does not return a value.


	hello = structNew(); = 2;
	hello.thing = "a string";
//	wddxfileWrite(expandPath("test.wddx"),hello);
//	stuff = WDDXFileRead(expandPath("test.wddx"));
<cfdump var="#stuff#">


Name Description Required
file The file to write to. Yes
var The value to serialize. Yes

Full UDF Source:

 Write a flat file containing a WDDX packet of any CF variable
 Updated for CFMX var scope syntax.
 @param file 	 The file to write to. (Required)
 @param var 	 The value to serialize. (Required)
 @return Does not return a value. 
 @author Nathan Dintenfass ( 
 @version 2, October 15, 2002 
<cffunction name="WDDXFileWrite" output="no" returnType="void">
	<cfargument name="file" required="yes">
	<cfargument name="var" required="yes">
	<cfset var tempPacket = "">
	<!--- serialize --->
	<cfwddx action="cfml2wddx" input="#var#" output="tempPacket">
	<!--- write the file --->
	<cffile action="write" file="#file#" output="#tempPacket#">
blog comments powered by Disqus


Latest Additions

Kevin Cotton added
May 5, 2016

Raymond Camden added
April 25, 2016

Chris Wigginton added
January 18, 2016

Gary Stanton added
November 19, 2015

Sebastiaan Naafs - van Dijk added
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson