Great Tutorial -- thanks
<cffunction
name="WriteChartToFile"
returntype="string"
hint="Accept parameters and return a string that is the code necessary to display a .swf file">
<cfargument
name="chartname"
type="any"
required="true"
hint="Pass in a variable that contains the cfchart flash data">
<cfargument
name="width"
type="any"
required="true"
hint="Pass in a numeric width for the resulting chart">
<cfargument
name="height"
type="any"
required="true"
hint="Pass in a numeric height for the resulting chart">
<cfargument
name="chartformat"
type="any"
required="true"
hint="Pass the chart type you are giving me. Valid types are flash,jpg, or png">
<!--- figure out file name extension based on chart type --->
<cfswitch expression="#Arguments.chartformat#">
<cfcase value="flash"><cfset Fileext = '.swf'></cfcase>
<cfcase value="png"><cfset Fileext = '.png'></cfcase>
<cfcase value="jpg"><cfset Fileext = '.jpg'></cfcase>
</cfswitch>
<!--- First, generate a random file name --->
<cfset filename = RandRange(10000, 99999) & '#fileext#'>
<cftry>
<cfif FileExists(#ExpandPath('charts/' & filename)#)>
<cffile action="delete" file="#ExpandPath('images/' & filename)#">
</cfif>
<cfcatch type="any"></cfcatch>
</cftry>
<cflock name="ReservationChart" type="exclusive" timeout="10">
<cffile
action="write"
charset="ISO-8859-1"
file="#ExpandPath('charts/' & filename)#"
output="#arguments.chartname#"
addnewline="yes">
</cflock>
<cfset tempstring = "<div style='z-index:-5;' align='left'><object><param name='movie' value='charts/#filename#'>
<embed src='charts/#filename#' width='#Arguments.Width#' height='#Arguments.Height#'></embed>
</object></div>">
<cfset returnstring = '#Replace(tempstring, "'", """", "ALL")#'>
<cfreturn returnstring>
</cffunction>
<!---// END chart.cfc //--->
Great Tutorial -- thanks