[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


ColdFusion Language





ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

Share tech news, updates, or what's on your mind.

Sign up to Post

Coldfusion 10 Websockets Algorithm. I'm adding functionality to a simple coldfusion websocket chat application. The added functionality is 1) to display the name and picture of the person who is in the chatroom  and 2) to have a text file that all users can modify. I'm currently working on #1 but I just realized that I'll have to change the way the publish calls are made if I want to account for multiple operations. My question is: What is the best way to implement a ColdFusion websocket app to account for multiple actions. I understand that the publish method can accept "custom header" information so I'm following that methodology but I'm not sure how to read the header info and if I should do that on the javascript part or the server messageHandler. I'm passing in the info like this:  

wsObj.publish("ch1",'Hello World', {ui_trigger:  'btn3', empoyeeId: '12345'});

Does that seem right or is there a better way of doing it? I'm trying to capture the btn3 and 12345 data.

I have read websocket documentation and read multiple google searches for this but haven't really found a good example.
The main thing that I want to accomplish is to separate all actions and handle them all differently but to make sure all the data gets published to the other clients.
Rowby Goren Makes an Impact on Screen and Online
LVL 12
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

I have 15K files on a hard drive.  Each file is named with the fileID and the file name such as, 38987833_ThisIsMath.doc or 42895633_Science123.pdf.  I have a list of all assetIDs which again make up the first 8 characters of the filename before the underscore.  

I have about 3000 files that I need to move into a separate directory.  Can someone tell me the best way to do this?  I believe I can use <cffile action="move">, but unsure of how to loop through my list of fileIDs to find the file in the directory.  Basically I want to be able to say, loop through my list of 38987833,42895633,87879888 and find each file and move it.

Any suggestions would be appreciated

When using ExpandPath, I will occasionally get something unexpected. For instance, I'm trying to move a file from one directory to another.
<cffile action="MOVE" source="#ExpandPath('/tmp/bloop.jpg')#" destination="#ExpandPath('/final-images/bloop.jpg')#">

Open in new window

This is the error I'm receiving:
An exception occurred when performing a file operation moving a file to another filesystem on files /var/www/vhosts/[sitename].com/tmp/bloop.jpg and /opt/coldfusion10/cfusion/bin/redirect:/final-images/bloop.jpg.The cause of this exception was: java.io.FileNotFoundException: /opt/coldfusion10/cfusion/bin/redirect:/final-images/bloop.jpg (No such file or directory).

You'll notice that the expanded base of the source is /var/www/vhosts/[sitename].com (which is what you'd expect it to be) while that of the destination is /opt/coldfusion10/cfusion/bin/redirect:

What's going on here? This isn't the first time I've run across this issue, but I can't seem to Google anything up about it. We're running CF10 on a Linux server. Thanks!
I need to create a set of dropdowns that are related to each other in coldfusion. The second dropdown should update itself based on what is selected in the first. Both will draw data from queries but from 2 separate data tables (cities and states). When the form finally submits, want to be able to retrieve id numbers from each dropdown

Have tried a number of coding variations with no luck
I have the below code sample and need to confirm the correct usage of CFTRANSACTION  and that a variable newID is being called to correctly:

<CFQUERY name="newID" datasource="#dsn#">
SELECT MAX(ID) + 1 AS newid FROM TLAApprovers
<CFIF newID.recordcount is 0>
<CFSET newid2 = 0>
<CFSET newid2 = newID.newid >

<cfquery name="updateMain" datasource="#dsn#">
Insert INTO TLAApprovers (ID, Name, Unit, ApproverEmail, Status)
Values ('#newid2#', '#form.Name#', '#form.unit#', '#form.ApproverEmail#', '#form.status#')

Open in new window

I need to rewrite a slq query within a cold fusion file to get rid of INDENTITY_ON and IDENTITY_OFF due to security issues. I've started recoding using IDENTIYCOL but I'm stuck. Below is the current code that will need to be rewritten w/ result_name.IDENTITYCOL vs. INSERT_IDENTITY ON/OFF. I opened a previous question about this but that was to work using IDENTIY_INSERT ON/OFF. I'll close that question but really need help on this asap.

1:<cfif ((#duplClaim# NEQ "Y") and (#requestId# EQ 0))>
2:<cfquery name="getNextID" datasource="#dsn#">
3:select (max(id) + 1) as nextID from TLAClaims
5:<cfset requestId = "#getNextID.nextID#">
7:<cfquery name="InsertClaim" datasource="#dsn#">
9:insert into TLAClaims (ID, lastName, firstName, eeEmail, travelbegindate, travelenddate, numberofdays,  unit, approver, submitdate, tono, claimAmount, customerNotes,  employeeId, documentation, status, deoEmail, claimType)
10:values ('#requestId#', upper('#lastName#'), upper('#firstName#'), '#eeEmail#', '#travelbegindate#', '#travelenddate#', '#numberofdays#', '#unit#', '#approver#', '#todaysDate#', '#tono#', '#claimAmount#', '#customerNotes#', '#employeeId#', '#documentation#', 'Inactive', '#deoEmail#', '#claimType#')

 I've started writing this code w/o the INSERT_IDENTIY ON/OFF but I'm stuck now:
1:<cfif ((#duplClaim# NEQ "Y") and (#requestId# EQ 0))>
2:<cfquery name="getNextID"…
After upgrade from CF2016 to CF2018 getting "connection refused" error on open CSV file. SQL Server 2012. Windows Server 2012
It is working with CF2016 but not CF2018

     HTML Code Format  <PRE>Error Executing Database Query. [Macromedia][SequeLink JDBC Driver]TCP/IP error, connection refused. &lt;br&gt;The error occurred on line 40.</PRE> 

Open in new window

<cfset FilePath = "C:\home\mywebsite\wwwroot\test\countrycodeToDialcode.csv">
             <cfquery name="GetInternationalDialcode" datasource="dialCodes"
             cachedWithin = "#CreateTimeSpan(1, 0, 0, 0)#">
                           SELECT *
                           FROM #filePath#

Open in new window

I have ColdFusion 10 installed. I am using <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 5, 0 ) /> and <cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 0, 5 ) /> to inactivate a session when there has been more than 5 unit of inactivity. I would like the user to re-login. The problem is that the login.cfm and index.cfm are in the root directory together with application.cfc. If a time out occurs at http://mycom.com/customer/receivables/showPayment.cfm and user clicks on reload button of browser, user is not redirected to login screen. Is there a trigger in CreateTimeSpan to redirect the user to http://mycom.com/index.cfm upon inactivity?
I'm getting a couple of error message when running a sql query from a cold fusion file. I believe if I solve one I can solve the other but I'm not exactly sure how to best solve it.


Error Executing Database Query.[Macromedia][SQLServer JDBC Driver][SQLServer]IDENTITY_INSERT is already ON for table 'tlaSQL.dbo.TLAApprovers'. Cannot perform SET operation for table 'TLACLAIMS'. The specific sequence of files included or processed is: D:\inetpub\wwwroot\TLA\Admin\TLAattachments.cfm, line: 148 

Open in new window

Error Executing Database Query.  
[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot find the object "TLACLAIMS" because it does not exist or you do not have permissions.  
The error occurred in D:/inetpub/wwwroot/TLA/Admin/TLAattachments.cfm: line 146
144 : <cfset requestId = "#getNextID.nextID#"> 
145 : 	
146 : 	<cfquery name="qTurnOnInsert" datasource="#dsn#">
148 : </cfquery>

DATASOURCE   tlasqlpp 

Open in new window

Sample code w/in cfm file:

<cfquery name="qTurnOnInsert" datasource="#dsn#">

<cfquery name="qTurnOnInsert" datasource="#dsn#">

<cfquery name="InsertClaim" datasource="#dsn#">
insert into TLAClaims (ID, lastName, firstName, eeEmail, travelbegindate, travelenddate, numberofdays,  unit, approver, submitdate, tono, claimAmount, customerNotes,  employeeId, documentation, status, deoEmail, claimType) 
values ('#requestId#', upper('#lastName#'), upper('#firstName#'), '#eeEmail#', '#travelbegindate#', '#travelenddate#', '#numberofdays#', '#unit#', '#approver#', '#todaysDate#', '#tono#', '#claimAmount#', '#customerNotes#', '#employeeId#', '#documentation#', 'Inactive', '#deoEmail#', '#claimType#')

Open in new window

I've researched and come up w/ turning the insert off then back on after the query. I've also landed on possibly using result_name.IDENTITYCOL but that looks like its only useful for a cf dump from what I've found. Can anyone help w/ this?

Thanks much for any help.
I manage a bunch of websites that mostly use Coldfusion. Each website is located in its own directory on the server and they all use the same version of the code and they each have their own database. I am trying to figure out what is the best way to update all of the sites when I make a change to the code. Right now I have created a directory on the server that contains the changed files and then I use directoryCopy to copy over the new files. My code looks something like the following:
<cfset temp = directoryCopy("_UpgradeCode","website_to_update_directory/",true,"*.*")>

Open in new window

One issue that I have is that I don't know if there were any problems copying over the code.

Can anyone suggest a better way to update websites? I am hoping that this can be done in an automated way so that I can just call a function or something and then it automatically updates all of the sites. I have created a list of sites to update that can be passed to the function.

Thank you for any help that you can provide about this.
JavaScript Best Practices
LVL 12
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Hello. I'm having an issue returning an XPath value. The statement runs and I see the 4 nodes returned but when I try to get the "Text()" value for them. Nothing returns. Can you please let me know why the syntax is failing?  

This works:  

This does not work:
nor this
nor this
Good day,

I would like to display the image which is stored in an MS SQL database. However, so far we have been unable to do so.

The field as defined in MS SQL is shown in capture.jpg

When viewing the content of the field, it is displayed as shown in capture1.jpg

When running the below program, the content is displayed as in capture2.jpg

<cfquery name="q1" >
      select top 1

      <table border='1'>
            <cfloop query="q1" >
                        <td>#q1.poImage# /></td>

Any help is highly appreciated
Greeting Experts! I have a coding issue that I could use some help with. I'm using ColdFusion 10 to try and parse a Microsoft Word document, extract the contents, keep it's formatting, and put it into a SQL Server database in multiple parts. For example if the word doc were HTML, each row would go into the database separately. This is turning out to be a tough nut to crack. I'm having trouble with the XPath part. I can find individual cells with the XML structure that ColdFusion creates but I can't seem to list all child nodes for a given element. This is all an attempt to keep the MS Word formatting, including special characters. I know parsing HTML would be easier but the goal is to do it with the original MS Word document. Given the key words from the left hand column, the Word Doc will filter out the Details Text in the right column. For example if the key word search was "Bob" then only the rows that have "Bob" in the first column will be displayed. I'd like to stay away from third party plug-ins. Any help is appreciated.  Thank you.
I have a scenario where I need to automatically upload client file(CSV, Excel, etc...) to CF Server.

However, no user intervention is allowed. The process will be done using the Coldfusion's job scheduler.

We use to use CFFTP but this is not allowed on the host server anymore.

Some experts guided us in the direction of using CFHTTP. However, we have never use this before.

Any suggestion is highly appreciated
I have code that I have used on three other projects without issue but for some reason on this site, the autocomplete (jquery) will not show the dropdown.   Dev tools is showing that it is reading the .cfc file and returning the values it should be but nothing shows up.  I tried various CSS fixes for z-index but that didn't help either.  I can't figure out what else i am missing or have wrong...


Open in new window

Hello everyone. I need some help with this Colfusion component.. I need to pass the values extracted form the cfqueries into the values in the cscript...

<!--- I have the following queries --->
<cffunction name="GetNumbers">
<cfquery name="Fall2006" datasource="#db#" > 
      select sum(transfer_y1_2y_public) as y12y, sum(transfer_y2_2y_public) as y22y, sum(transfer_y3_2y_public) as y32y, sum(transfer_y4_2y_public) as y42y, sum(transfer_y5_2y_public) as y52y, sum(transfer_y6_2y_public) as y62y from transfer where transfer_entry_sector = <cfqueryparam cfsqltype="cf_sql_varchar" value="TWO_YEAR_PUBLIC">
      and transfer_year = <cfqueryparam cfsqltype="cf_sql_integer" value="2006">

<cfquery name="Fall2008" datasource="#db#" > 
      select sum(transfer_y1_2y_public) as y12y, sum(transfer_y2_2y_public) as y22y, sum(transfer_y3_2y_public) as y32y, sum(transfer_y4_2y_public) as y42y, sum(transfer_y5_2y_public) as y52y, sum(transfer_y6_2y_public) as y62y from transfer where transfer_entry_sector = <cfqueryparam cfsqltype="cf_sql_varchar" value="TWO_YEAR_PUBLIC">
      and transfer_year = <cfqueryparam cfsqltype="cf_sql_integer" value="2008">

<cfquery name="Fall2010" datasource="#db#" > 
      select sum(transfer_y1_2y_public) as y12y, sum(transfer_y2_2y_public) as y22y, sum(transfer_y3_2y_public) as y32y, sum(transfer_y4_2y_public) as y42y, sum(transfer_y5_2y_public) as y52y, sum(transfer_y6_2y_public) as y62y from transfer where …
I need to be able to push notification to users phone. I am trying to use ColdFusion to do that. However, I have issues. I found the site that supposed to explains how to do that with coldfusion .http://www.rickgroenewegen.nl/?p=77

However there is still some problems . If I doing thing on the fly I do not know what their phone type is (apple or android).
I have the below program. Can somebody point out why the content of parmArray in function "doCalc"  changes whle
no operation is being performed on it.

I have been pulling my hair on this issue for about 2 days now.

Any help is greatly appreciated.

<cfset aAr1 = arrayNew(1)>
<cfset s = structNew()>
<cfset s.date = 'xx'>
<cfset s.interest = '250'>
<cfset aAr1[1] = s>
<cfset s = structNew()>
<cfset s.date = 'yy'>
<cfset s.interest = '300'>
<cfset aAr1[2] = s>
<cfset s = structNew()>
<cfset s.date = 'zz'>
<cfset s.interest = '350'>
<cfset aAr1[3] = s>

<cfinvoke   method="doCalc" returnvariable="aResult1">
    <cfinvokeargument name="parmArray"  value="#aAr1#">

<cffunction name="doCalc" returntype ="array">
    <cfargument name="parmArray" required="true" type="array">

      <cfdump var = "#parmArray#" label="before">
      <cfset LOCAL.aAr2 = parmArray>
      <cfloop index="LOCAL.nIDX" from="1" to="#arrayLen(LOCAL.aAr2)#" >
            <cfset LOCAL.aAr2[LOCAL.nidx].date = LOCAL.nIdx>

      <cfdump var = "#parmArray#" label="after">      
    <cfreturn LOCAL.aAr2>
ColdFusion 9

Create 2 excel files at once

I use this to create a single excel file:

<cfquery database="somedb" name="somequery">
       ... my query ...

<cfspreadsheet action="write" query="somequery" filename="/C-Items_#custno#_#contractid#.xls" sheetname="temp" overwrite="true">
<cfheader name="Content-Disposition" value="attachment; filename=C-Items_#custno#_#contractid#.xls">
<cfcontent type="application/vnd.ms-excel" file="/C-Items_#custno#_#contractid#.xls" deletefile="yes">

I have found myself in a situation where I need a second excel file created (under certain circumstances).

<cfif filedneeded eq "yes">
      ... my code above ...
<cfif secondfileneeded eq "yes">
     ...different query than above, but <cfspreadsheet/cfheader/cfcontent> code similar ...

When I try this I only get the first excel file and not the second ... as if the <cfheader> or <cfcontent> aborts the code and the second <cfif> never runs.  I can easily create either spreadsheet from 2 separate links on my page that directs the user to the correct chunk of code, but I'd like to automate this because the need for a second excel file is only sometimes, and my users seems to often forget to click the second link.

Hope that makes sense.

Learn Ruby Fundamentals
LVL 12
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

FormEntry ErrorServer Settings Page 1Server Settings Page 2Hi,
I am running Coldfusion v9 (migrated from Coldfusion v7) and running on error on the same cfm page that used to run just fine in CF7 environment.
I found an article where they talk about this type of error and apparently one person in that discussion pointed out that we can turn this feature off.
Here is the link:

However it does not say exactly what feature/function to turn off in CF admin.

Can you help?
I have a form that allows for multiple file uploads using the "multiple" attribute on an input type="file" field. The results are being passed to a cfc that should upload the files, resize them, crop them for thumbnails, etc.

I have the photoUpload argument of the cfc (the name of my field being photoUpload) set to type=any, because if you upload a single file it's passed as a string while multiple files are passed as an array. My question is how to tell the code that comes after if there's one file or many. Should I test to see if photoUpload is a simple value, then if it is do ListToArray and just "loop" over the one? Or is there a better way to handle this before it even gets to the cfc?

Additionally, when I loop over the array it's always giving me the last file name as the name, causing overwrite issues. Can you tell where I'm going wrong? (Ignore all the CFCATCH messages being returned with the message, that's just for my own troubleshooting.) It's similar to this question but she had multiple fields and loops.

<cfif IsSimpleValue(ARGUMENTS.photoUpload)>
			<cfset photoArray = ListToArray(photoUpload)>
			<cfset photoArray = ARGUMENTS.photoUpload>
<!--- upload image(s) --->
		<cfloop from="1" to="#ArrayLen(photoArray)#" index="i">
				<cffile action="upload" 

Open in new window

I have create a .jsx file from photoshop and using cfexecute to run it. If I use cfexecute from the web it does not execute the script . If I take the script and execute it locally using ExtendScript Toolkit then it works like a charm. I do not know what do to make it work through  the web .

<cfexecute name="C:\Program Files (x86)\Adobe\Adobe Photoshop CS2\photoshop.exe" 
arguments="C:\inetpub\wwwroot\websites\myscript.jsx" timeout="6000" variable="returnedResults" 
      errorVariable="returnedError"  ></cfexecute>

Open in new window

the script is here

#target photoshop

$.localize = true;

var inputFolder = new Folder("/c/work_space/2018/pdfs")
var saveFolder  = new Folder("/c/work_space/2018/JPEG")

function createFolder(fptr) {
  if (!fptr) {
    Error.runtimeError(19, "fptr");  // Bad Argument

  if (fptr.constructor == String) {
    fptr = Folder(fptr);

  if (fptr instanceof File) {
    return createFolder(fptr.parent);
  if (fptr.exists) {
    return true;
  if (fptr.parent && !fptr.parent.exists) {
    if (!createFolder(fptr.parent)) {
      return false;
  return fptr.create();


if (inputFolder != null)
var inputFiles = inputFolder.getFiles("*.pdf")

for(var i=0;i<inputFiles.length;i++)

var fileRef = File(inputFolder + "/" + inputFiles[i].name)
var pdfOpenOptions = new PDFOpenOptions
pdfOpenOptions.antiAlias = true
pdfOpenOptions.mode = OpenDocumentMode.RGB
pdfOpenOptions.cropPage = 

Open in new window

MacOS Sierra plug-in configuration a qualified success.  However, I have no CFB perspective.
Install log says:
Installation: Successful with errors.
6454 Successes
0 Warnings
2 NonFatalErrors
0 FatalErrors
Non fatal errors being two occurrences of
Modify Text File - Single File:   /Users/barrygbrunning/eclipse/java-oxygen/Eclipse.app/Contents/Eclipse/Eclipse.app/Conten ts/Info.plist
                          Status: ERROR
                          Additional Notes: ERROR - Unable to locate ASCII text file to be manipulated. Deferring...
Indeed there is no such file, whereas there is a file /Users/barrygbrunning/eclipse/java-oxygen/Eclipse.app/Contents/Info.plist.  At the install log errors referenced path /Users/barrygbrunning/eclipse/java-oxygen/Eclipse.app/Contents/Eclipse/ are located folders: configuration, droppins, features, jre, plugins, readme and the eclipse.ini file, but no info.plist.
The implied "Deferring..." action seems to have not happened.  Any suggestions as to what I might do to recover the situation?  What should have happened to an info.plist somewhere? How might I get the CFB perspective to manifest in Eclipse?

Any help will be greatly appreciated.  Thank you.
I can't seem to find why these two pages are showing the header areas differently. I don't see a difference w/in the code that would cause this. Both reports use the same styles and configuration for the tables and images. Only difference is one is an html file and one is a cfm. See below for screenshots and code comparison.

Showing correctly - index.html:

<cfset #date# = #DateFormat("#Now()#","mmmm dd, yyyy")#> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<title>XXXXXXXX Report Query</title>

<script language="JavaScript" type="text/JavaScript">
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

<link href="../css/home.css" rel="stylesheet" type="text/css" />
<LINK rel="Home" title="Index page of FINCEN Intranet site"

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" background="../images/grad2b.gif">
      <td width="10%">&nbsp;</td>
      <td width="80%" valign="top">
	     <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >

Open in new window

I have created the system DSN and as well User DSN on my system control panel successfully by ODBC Connector  against MySQL 8 server DB. now i want to use this this database on my ColdFusion server and for this i am creating the Data-source on my ColdFusion server. But there showing errors . Please guide me that how can i use this database or DSN on my ColdFusion server and what type of driver i have to select in ColdFusion administration for creating Data-source .

Thanks In advance!

ColdFusion Language





ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

Top Experts In
ColdFusion Language