– Common Function Library Project


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 WDDXFileWrite()

Return Values:
Returns deserialized data.


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


Name Description Required
file File to read and deserialize. Yes

Full UDF Source:

 Reads a file containing WDDX and returns the CF variable.
 Updated for CFMX var scope syntax.
 @param file 	 File to read and deserialize. (Required)
 @return Returns deserialized data. 
 @author Nathan Dintenfass ( 
 @version 2, October 15, 2002 
<cffunction name="WDDXFileRead" output="no">
	<cfargument name="file" required="yes">
	<cfset var tempPacket = "">
	<cfset var tempVar = "">
	<!--- make sure the file exists, otherwise, throw an error --->
	<cfif NOT fileExists(file)>
		<cfthrow message="WDDXFileRead() error: File Does Not Exist" detail="The file #file# called in WDDXFileRead() does not exist">
	<!--- read the file --->
	<cffile action="read" file="#file#" variable="tempPacket">
	<!--- make sure it is a valid WDDX Packet --->
	<cfif NOT isWDDX(tempPacket)>
		<cfthrow message="WDDXFileRead() error: Bad Packet" detail="The file #file# called in WDDXFileRead() does not contain a valid WDDX packet">		
	<!--- deserialize --->
	<cfwddx action="wddx2cfml" input="#tempPacket#" output="tempVar">
	<cfreturn tempVar>    
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