ColdFusion Language

10K

Solutions

3K

Contributors

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

I have been uploading pdf and jpg file from our local server to a hosted server using FTP. However, for security reasons the hosted server stopped the FTP service two weeks ago. The hosted server told us to start using CFHTTP to replace FTP.

We were using CFFTP for:
<cfftp action = "open"
<cfftp action = "remove"
<cfftp action = "close"
<cfftp action = "LISTDIR"
      Etc…

Does anyone have a Coldfusion example on how to transfer file from a local server to hosted server ? I have never used CFHTTP before
0
Free Tool: IP Lookup
LVL 9
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I need to validate a date field of 3 letters to be all uppercase...i.e. JAN, FEB, MAR, etc. Its only one field. This posts to a cfm file. Required field for the accounting period has to be MON-YYYY.

Accounting Period:            *MON-YYYY

I was hoping to do something like this but its not taking:

            <td colspan="3" class="maintxt12_bold"><input name="period" type="text" validate="regular_expression" pattern="^[A-Z}$" class="Headline12DrkBlu" id="period" size="10" maxlength="8" required="yes" message="Please use only uppercase letters for the date field, i.e. JAN, FEB, MAR.">
                        &nbsp;<span class="Arial_Red12Bold">* CG: MON-YY, If DNDO or TSA: MON-YYYY</span></td>

Open in new window


Thanks for any help.
0
I have a ColdFusion 11 component which is supposed to populate a cfselect using bind. However, the select is not populated with the values at all. It shows blank. These are 2 select form controls that I want to relate to each other. A select from one should populate the other with values based on the selection made.cfselectbind.txtcfselectbind.txt
0
I need a form field mask for a date field to read: MM/DD/YY in a cold fusion form.

I have other fields working but the date field won't take. Would the letters vs. numbers be issue. My current code is setup for the mask:

<cfset session.invoiceDataContr.Invoice_Date = "MM/DD/YY" >

Open in new window

 <font face="Arial" size="2" color="#990000"><label for="Invoice_Date">Invoice Date:&nbsp;</label>
                        <input  id="Invoice_Date"  name="Invoice_Date" size="15" maxlength="8" type="date"  tabindex="8"  value="<cfif structkeyexists(session.invoiceDataContr, "PASS")><cfoutput>#session.invoiceDataContr.Invoice_Date#</cfoutput><cfelse><cfoutput>#form.Contract_Number#</cfoutput></cfif>" required/>

Open in new window

0
ColdFusion 9
Windows Server 2008
IIS 7

I am trying to delete a file using CFFILE, but I keep getting the following error:

"ColdFusion could not delete the file P:/ColdFusion9/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/xxxx.pdf for an unknown reason."

This happens for .jpg, .gif, .txt, .pdf so far (that I have tested).  However, these files work fine: .xls, .xlsx, .doc, .docx.  If I remove the isSpreadsheetFile CFIF block, it works fine for all files, so I figure that is what is causing the problem.  It is like isSpreadsheetFile is having problems reading files other than MS OFFICE files and as a result locks them.

This is my code:

<cfset dest = getTempDirectory()>
    
        <cffile action="upload" destination="#dest#" filefield="filename" result="upload" nameconflict="makeunique"  />
        
		<cfif upload.fileWasSaved>
            <cfset theFile = upload.serverDirectory & "/" & upload.serverFile>
            <cfif isSpreadsheetFile(theFile)>
                <cfspreadsheet action="read" src="#theFile#" query="data" headerrow="1">
                <cffile action="delete" file="#theFile#">
            <cfelse>
                <cfset errors = "The file was not an Excel file." />
                <cffile action="delete" file="#theFile#">
            </cfif>
        <cfelse>
            <cfset errors = "The file was not properly uploaded.">    
        </cfif>

Open in new window


Any one have an idea?  I really like the isSpreadsheetFile tag, but the way it is, I cannot use it.

Max
0
I need to validate a date field with MM/DD/YY requirements using a regex within a cold fusion form.
0
I'm trying to integrate a coldfusion app with MS sharepoint. Both sites are within the intranet so it shouldn't be anything network related. I'm able to browse to the wsdl file from a browser but the cfsharepoint tag part gives following error:

Unable to read WSDL from URL: https://nri.pcd.com/books/authors/_vti_bin/Lists.asmx?wsdl.

***********************************************************************************
Here's my cf code snippet:
***********************************************************************************
<cfscript>
      login = {domain="https://nri.pcd.com",
      username="uname", password="pwd"};
</cfscript>

<cfoutput>
      
            <cfsharepoint action="getlistcollection"
                  wsdl="https://nri.pcd.com/books/authors/_vti_bin/Lists.asmx?wsdl"
                  login="#login#"      name="result">
</cfoutput>

<cfdump var="#result#">
0
Current code that's breaking is:

1:^(([\w\!#$%&'*+-/=?^_`{|}~;]+(?:\.[\w\-_]+)*@(?:[\w\-_]+\.)+[a-zA-Z]{2,7})[;]?)+$

Open in new window


error message:

"Error","ajp-bio-8012-exec-5","07/31/17","10:55:57",,"Invalid CFML construct found on line 214 at column 73.ColdFusion was looking at the following text:<p>\'</p><p>The CFML compiler was processing:<ul><li>An expression that began on line 214, column 69.<br>The expression might be missing an ending #, for example, #expr instead of #expr#.<li>The tag attribute pattern, on line 214, column 53.<li>A cfparam tag beginning on line 214, column 6.<li>A cfparam tag beginning on line 214, column 6.<li>A cfparam tag beginning on line 214, column 6.</ul> The specific sequence of files included or processed is: D:\inetpub\wwwroot\centralinv\central_inv_contr_verify.cfm, line: 214"

I'm guessing the # is throwing an issue and maybe the $ and ^ ... anyone have any ideas to get around the coding errors for those characters:
0
Hello Experts,

I have trouble getting a Connection Failure. Status code unavailable. response  after waiting for longtime.

Response when using coldfusion to submit
response
Response when copy pasting the URL in the borwser

 
{
  "success": true,
  "challenge_ts": "2017-07-28T17:28:02Z",
  "hostname": "wsq02230"
}

Open in new window


<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<cfsetting requestTimeOut = "9000" />
<cfparam name="FORM.username" default="" type="string" >
<cfparam name="FORM.password" default="" type="string" >

<cfif structKeyExists(FORM,"submit")>
	
	<cfset recaptcha = FORM["g-recaptcha-response"] >
	<cfif len(recaptcha)>
		
		<cfset googleUrl = "https://www.google.com/recaptcha/api/siteverify">
		<cfset secret = "XXXXXXX">
		<cfset ipaddr = CGI.REMOTE_ADDR>
		<cfset request_url = googleUrl & "?secret=" & secret & "&response=" & recaptcha & "&remoteip=" & ipaddr >
		
		<cfoutput>
		#request_url# 
				<cfoutput>
				<!--- <cfhttp url="#request_url#" method="post" timeout="10" result="captcharesult">
					<cfhttpparam name=remoteip value="#ipaddr#" type="url">
				</cfhttp> --->
				<cfhttp url="https://www.google.com/recaptcha/api/siteverify" method="post" result="captchaResult">
				  <cfhttpparam type="formfield" name="secret" value="#secret#"> 
				  <cfhttpparam type="formfield" name="response" value="#recaptcha#"> 
				  <cfhttpparam type="formfield" name="remoteip" value="#CGI.REMOTE_ADDR#"> 
				</cfhttp>
				
		

Open in new window

0
I have a cold fusion form which requires me to add a try catch around the form fields. I keep getting an error message however when I try to add it. Code below thanks for any help you provide if you see something obvious I'm missing.
 <cftry> 	
   	<cfif NOT refind("^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$", form.Contract_Number) AND NOT refind("^70[Zz]0[a-zA-Z0-9]{2}\d{2}[a-zA-Z][a-zA-Z0-9]{8}$", form.Contract_Number)>
   	<cfcatch>
	   <cfset #session.invoiceDataContr.errorString# = "The Contract Number is required and can contain no more than 22 alphanumeric characters.,">
	</cfif>
    </cfcatch>
</cftry>

Open in new window


error log message:
"Error","ajp-bio-8012-exec-3","07/25/17","11:45:07",,"Context validation error for the cfcatch tag.The tag must be nested inside a CFTRY tag. The specific sequence of files included or processed is: D:\inetpub\wwwroot\centralinv\central_inv_contr_verify.cfm, line: 121 "
0
Containers & Docker to Create a Powerful Team
Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Form field validation for a date requirement to be: Current date on or after 10/01/2017 - cold fusion form

A new requirement for a form. I need to detect the date a form is being submitted to be the current date on or after 10/01/2017 in a cold fusion form.

The date won't be placed into the form field/s but I need to detect the date. This will be implemented on 10/01/2017 fyi. I'll need to set the code up to test say for today's date then once working set it up to detect 10/01/2017 for when it goes live.

Thanks for any help. I'll start researching the topic as I've never tried to work this type of code before. Current code for one of the fields is:

  <cfset errorMsg = ""> 
   	<cfif NOT refind("^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$", form.Contract_Number) AND NOT refind("^70[Zz]0[a-zA-Z0-9]{2}\d{2}[a-zA-Z][a-zA-Z0-9]{8}$", form.Contract_Number)>
	   <cfset errorMsg = "The Contract Number is required and can contain no more than 22 alphanumeric characters.,">
	</cfif>
	<cfset session.invoiceDataContr.errorString = errorMsg>

Open in new window

0
I need to validate 2 form fields w/ similar criteria for each field but each needs to validate w/ an older set of criteria and a new one. Code below:

  <cfset errorMsg = ""> 
   	<cfif NOT refind("^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$", form.Contract_Number) AND NOT refind("^70[Zz]0[a-zA-Z0-9]{2}\d{2}[a-zA-Z][a-zA-Z0-9]{8}$", form.Contract_Number)>
	   <cfset errorMsg = "The Contract Number is required and can contain no more than 22 alphanumeric characters.,">
	</cfif>
	<cfset session.invoiceDataContr.errorString = errorMsg>

Open in new window


     <cfset errorMsg = "">     
   	<cfif NOT refind("^[Hh][Ss][Cc][Gg][A-Za-z0-9]{1,21}$|^$", form.Task_Order) AND NOT refind("^70[Zz]0[A-Za-z0-9]$", form.Task_Order)>
	   <cfset errorMsg = "The Delivery/Task Order Number must begin with HSCG with a maximum of 25 alphanumeric characters. Do not use hyphens or special characters. The
Delivery/Task Order Number can be found in block 4 of the SF-1449 form or in block 3 of the OF-347 form.,">
	</cfif>	
	<cfset session.invoiceDataContr.errorString = errorMsg>

Open in new window


Do I need 2 different cfset params? Not sure what's up. won't catch the second validation
0
Hi, I have a dynamic CF page with  printout tables. Problem is with printing. Table printout can be split depending on the dynamic content. I need to force a new page for each table output. Is there a CF or html string I can use to force this break

many thanks
0
I have a very simple JSON feed and have been able to parse the feed using the below code. However, when the script gets to the "OFFERS" structure, it won't output the results cause it sees the brackets [ ] and is treating the data as a LIST of objects under OFFERS instead of objects like they would be under normal braces { }. I don't know how to get Coldfusion to properly give me the subitems of OFFERS.  You can easily see the feed using the link I provide also.

<cfoutput>
<cftry>
	<cfhttp url="https://rest.bandsintown.com/artists/spencerkane/events?app_id=day6mgmt&date=2017-08-19" result="httpResult" charset="utf-8" method="get"/>
 	<cfset BITdata = deserializeJSON(httpResult.filecontent)/>
	<cfloop array="#BITdata#" index="post">
		<cfif StructKeyExists(post, "datetime")>
			<cfset event_date = post.datetime>
		<cfelse>
			<cfset event_date = "">
		</cfif>
		<cfif StructKeyExists(post, "venue") and StructKeyExists(post.venue, "name")>
		    <cfset ev_title = post.venue.name>
		<cfelse>
            <cfset ev_title = "">
		</cfif>
		<cfif StructKeyExists(post, "venue") and StructKeyExists(post.venue, "city")>
			<cfset city = post.venue.city>
		<cfelse>
			<cfset city = "">
		</cfif>
		<cfif StructKeyExists(post, "venue") and StructKeyExists(post.venue, "region")>
			<cfset region = post.venue.region>
		<cfelse>
			<cfset region = "">
		</cfif>
		<cfif StructKeyExists(post, "offers[url]")>
		<cfset tickets = post.offers[url]>
			<cfelse>
		<cfset tickets = "">
		

Open in new window

0
Hi,

Am newbie to ColdFusion Please tell me code for login process am so confused for that can't get understand login process in my analysis.

Am tried below code,

My Form Code like,

  <!DOCTYPE html>
<html>
<head>
<title>Login</title>
Please Log In
</head>
<body>
    <cfform  name="LoginForm" action="" method="Post">
    <table>
    <tr>
    <td>Username:</td>
    <td><cfinput type="text" name="username" size="20" maxlength="30" required="yes" validate="maxlength,required" message="The Username must be between 1 and 30 characters."><br></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><cfinput type="password" name="password" required="yes" pattern="^[a-zA-Z0-9._]{8,16}$" maxlength="35" validate="required,regex" message="The Password must be between 8 and 16 characters."><br></td>
    </tr>
    </table>
    <br>
    <cfinput type="Submit" name="SubmitLoginForm" value="Submit">       
    </cfform>
      </body>
</html>

Am checking  username and password in below code,

<cfif isdefined("form.SubmitLoginForm")>
      <cfquery name="getpassword" datasource="testcf">
      select username, salt, password ,id from user where username = "#form.username#"
      </cfquery>      
      <cfif getpassword.RecordCount EQ 1>
      <cfset passwordHash = Hash(form.password & getpassword.salt, 'SHA-512') />
      <cfoutput>
      #getpassword.id#
      </cfoutput>
      <cfif getpassword.password EQ passwordHash>      
      
      <cfset session.allowin = "True">
      <cfset userid = '#getpassword.id#'/>
      <cfset…
0
Hello.

I would like to be able to browse C: \ wwwroot at http: // localhost: 8500 / test.
This is displayed as it is actually accessed.

” the page you are trying to access cannot be displayed.
please try again or notify the administrator ”

Using IIS, the physical path is set to C: \ wwwroot.
Check and set index.cfm in the default document

I'm using
windows server 2012 R2
IIS 8.5
ColdFusion 2016

I am a beginner. Please give me advice on which other setting to do.
0
<cfoutput>
<cftry>
	<cfhttp url="https://rest.bandsintown.com/artists/spencerkane/events?app_id=day6mgmt&start_date=2017-01-01" result="httpResult" charset="utf-8" method="get"/>
 	<cfset BITdata = deserializeJSON(httpResult.filecontent)/>
	<cfloop array="#BITdata#" index="post">
		<cfif StructKeyExists(post, "datetime")>
			<cfset event_date = post.datetime>
		<cfelse>
			<cfset event_date = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.name")>
		    <cfset ev_title = post.venue.name>
		<cfelse>
            <cfset ev_title = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.city")>
			<cfset city = post.venue.city>
		<cfelse>
			<cfset city = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.region")>
			<cfset region = post.venue.region>
		<cfelse>
			<cfset region = "">
		</cfif>
		<cfif StructKeyExists(post, "offers.url")>
		<cfset tickets = post.offers.url>
			<cfelse>
		<cfset tickets = "">
			</cfif>

<!--- FEED OUTPUT --->        
<cfif not event_date is "">		
#event_date#<p>
#ev_title#<p>
#city#<p>
#region#<p>
#tickets#
<hr />
</cfif>		
	</cfloop>

	<cfcatch type="any">
		<p>
			<cfdump var="#cfcatch#" />
			#LSDateFormat(Now(), "dd-mm-yyyy")# #lsTimeFormat(Now(), "HH:mm")#<br />
			<a href="##">
				Oh, sorry... I can't connect to Bandsintown
			</a>
		</p>
	</cfcatch>

</cftry>
</cfoutput>

Open in new window


My output only gives me the datetime and none of the other structure data even though the raw feed in a browser window definitely shows there is more data to be displayed. I am using Adobe's output structure of data.struct1.substruct but it doesn't display anything.
0
Hello Experts,

I am working on a CF application and need a CF function equivalent to exit(); (PHP).

I am trying to addess this particular fix
Acunetix reference

This is what I am doing, but not sure if t works.  

<cfset GetPageContext().getCFOutput().clear()>
   <CFLOCATION URL="Login.cfm?Message=Logon ID must be 5 digits." ADDTOKEN="no">
	<CFABORT>

Open in new window


- Dan
0
I have courses for agents to study online.  I have a save and exit button when clicked will save their place and close the window.  However, if the student just clicks on the X on their browser and closes the window my system does not currently recognize that they are no longer active in the course.  We tried "onbeforeunload" but that gets triggered if the student is just going to the next page.  I only want to trigger it if they click to close the browser using the X.
0
Give Your Engineering Team a Productivity Boost
Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

I have a form that is completed online that now needs to be generated as a saved pdf file in a folder on the server. The name and location for the pdf would then be emailed to someone for them to retrieve for viewing. As an aside, would also need to know best way to have a signature placed into the pdf when created (I realize this is 2 questions in 1. 1st one more important for now)
0
I have a JSON feed which dumps a Facebook Page timeline feed. For some reason, Facebook allows a linked URL to be part of the actual message that is sent via JSON. So if I had a FB post that included a link to a Youtube video, it comes through the JSON feed like

'check out my cool new video http://www.youtube.com/myvideoid'

I'd prefer to strip out the url string from the JSON result and have it just give me

'check out my cool new video'

I know this has something to do with ReFindNoCase() or another similar thing, but I don't know how to write the code to strip it out and just leave me the message without the long url string.
0
Currently we are migrating from coldfusion 6 to coldfusion 2016.

<cfloop index="RSG004_i" from="1" to="#RSG004_dt.num#" step="1">

I want you to tell me how to deal with this error.
Thank you.
0
Hi,

Am using ColdFusion version 8,

Am export my Db recordset datas using,

<cfsavecontent variable="report">XXXXX</cfsavecontent>

<cffile action="write"  file = "#fullfile#" output="#report#" nameconflict="overwrite">

It's export fine,but I need to expand excel column width.Please Refer my attachment , I got my excel output like my attachment.file:///tmp/mozilla_geetha2/Employee_Report-3.xls
0
Hi, Here is the code i am trying to convert PHP code in ColdFusion code

Here is the code i have
public static function calculateSignature($consumerId, $privateKey, $requestUrl, $requestMethod, $timestamp=null)
    {
        if(is_null($timestamp) || !is_numeric($timestamp)){
            $timestamp = self::getMilliseconds();
        }
        /**
         * Append values into string for signing
         */
        $message = $consumerId."\n".$requestUrl."\n".strtoupper($requestMethod)."\n".$timestamp."\n";
        /**
         * Get RSA object for signing
         */
        $rsa = new RSA();
        $decodedPrivateKey = base64_decode($privateKey);
        $rsa->setPrivateKeyFormat(RSA::PRIVATE_FORMAT_PKCS8);
        $rsa->setPublicKeyFormat(RSA::PRIVATE_FORMAT_PKCS8);
        /**
         * Load private key
         */
        if($rsa->loadKey($decodedPrivateKey,RSA::PRIVATE_FORMAT_PKCS8)){
            /**
             * Make sure we use SHA256 for signing
             */
            $rsa->setHash('sha256');
            $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1);
            $signed = $rsa->sign($message);
            /**
             * Return Base64 Encode generated signature
             */
            return base64_encode($signed);
        } else {
            throw new \Exception("Unable to load private key", 1446780146);
        }
    }

Open in new window


I have been able to get the milliseconds using the java code which is like below

<cfset jDate = createObject("java", "java.util.Date")>
<cfdump var="#jDate.getTime()#">

Open in new window



but other part of the php code i am unclear of what is happening
0
We are looking to upgrade our coldfusion server (v 6.1) running server (2003) to a new server (server 2012) and ColdFusion 2016.

Looking for a solution/upgrade path.. If I need to upgrade first to a lower version.

If its not semi simple then possibly moving to another dev language.

Thanks in advance!
0

ColdFusion Language

10K

Solutions

3K

Contributors

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.