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 am trying to generate an HTML from an AJAX call, Below please find my code.

The content should display HELLO WORLD in bold. However, I am getting <strong>hello world</strong>

Any assistance is highly appreciated


AJAXHTML.CFM
============
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>

    <script type="text/javascript">

        $(document).ready(function() {
            $("#loadLink").click(function(e) {
                e.preventDefault();
                $.ajax({
                    type: "GET",
                    url: "ajaxHTML.cfc?method=createHTML",
                    contentType: "application/json; charset=utf-8",
                    dataType: "html",
                    success: function(message) {
                        $("#mydiv").html(message);
                    }
                });
            });
        });
    </script>
    
</head>

<body>
    <a href="" id="loadLink">Load Query</a>
    <!-- empty div to load dynamcically generated table into -->
    <div id="mydiv"></div>
</body>

Open in new window


AJAXHTML.CFC
============
<cfcomponent displayname="Generate HTML" output="false">


<cffunction name="createHTML" displayname="Create HTML" description="Creates HTML to output with jQuery." access="remote" output="false" returntype="string">

    <!--- SET VARIABLE TO RETURN --->
    <cfset VARIABLES.html = "">

    <!--- SAVE CONTENT --->

    <cfsavecontent variable="VARIABLES.html">
    	<strong>hello world</strong>
    </cfsavecontent>
    <!--- RETURN SAVED CONTENT --->
    <cfreturn VARIABLES.html>

</cffunction>

</cfcomponent>

Open in new window

0
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.

ColdFusion 9

I am trying to embed a signature image into an email.  The image is created:

<cfoutput><cfsavecontent variable="content">#TicketSignature#</cfsavecontent></cfoutput>
<cfset Signature = ImageReadBase64(content) />
<cfimage name="thisSignature" source="#Signature#" action="read" >

When I "WritetoBrowser" the image appears fine.  All good so far.

In my Cfmail tag I use:

<cfmailparam file="signature.png" contentid="signature" content="#thisSignature#" disposition="inline" type="image/png" />
and
<img src="cid:signature"> to show the image.

My problem:  For some reason the image in the email is viewed as a negative image ... black background and light blue signature.  Somehow, the cfmailparam tag is converting the image.  Why???  I have tried everything I can think of, but nothing will change it back to white background and black signature.

Any thoughts would be very helpful.

Max
0
I have a form that allows the user to create 5 different sets of results on the same form. I do this by using CFLoop. For example:
<cfloop from=”1” to=“5” Index=“i”>
Form FieldName#i#

So I end up with:
FieldName1
FieldName2
FieldName3
FieldName4
FieldName5

That part works great and keeps the form code short and clean considering there are 16 form fields.

Is there a way to loop over that data to insert it into a table. Each Index needs to be its own row in the table. For example…

<cfloop from=”1” to=“5” Index=“z”>
<cfquery datasource = “abc”>
Insert into XYZ (Name)
Values (#form.FieldName[z]#)
</cfquery>

What I don’t know how to do is use a variable (the index) within a variable (Form.Result).  Parts of the form need to go into 6 different tables times 5 sections of the form would be 30 SQL statements vs. 6 if I can loop.
0
I'm trying to duplicate a row in a MySQL table and give it a new ID (which is the primary key column.) If I run the query directly through phpMyAdmin, it works. If I run it on my CF page, it gives me the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE tempEvent SET ID = NULL; INSERT INTO calendar SELECT * FROM tempEvent' at line 4

Do you know why this would be? (As a side note, I get the same error if I use the cfqueryparam tag or hardcode a value, and with/without semicolons.) Thanks!

<cfquery datasource="#APPLICATION.ds#" result="copiedEvent">
	CREATE TEMPORARY TABLE tempEvent 
		SELECT * FROM calendar 
		WHERE ID = <cfqueryparam value="#FORM.eventID#" cfsqltype="CF_SQL_INTEGER">;
	UPDATE tempEvent 
		SET ID = NULL;
	INSERT INTO calendar SELECT * FROM tempEvent;
	DROP TEMPORARY TABLE IF EXISTS tempEvent;
</cfquery>

Open in new window

0
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
0
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
4:</cfquery>
5:<cfset requestId = "#getNextID.nextID#">
6:
7:<cfquery name="InsertClaim" datasource="#dsn#">
8:SET IDENTITY_INSERT TLACLAIMS ON
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#')
11:SET IDENTITY_INSERT TLACLAIMS OFF
12:</cfquery>

 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"…
0
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?
0
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.

Errors:

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#">
147 : SET IDENTITY_INSERT TLACLAIMS OFF
148 : </cfquery>

--------------------------------------------------------------------------------
 
VENDORERRORCODE   1088 
SQLSTATE   HY000 
SQL    SET IDENTITY_INSERT TLACLAIMS OFF  
DATASOURCE   tlasqlpp 
 
Resources:  

Open in new window


Sample code w/in cfm file:

<cfquery name="qTurnOnInsert" datasource="#dsn#">
SET IDENTITY_INSERT TLAApprovers OFF
</cfquery>

<cfquery name="qTurnOnInsert" datasource="#dsn#">
SET IDENTITY_INSERT TLACLAIMS ON
</cfquery>

<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#')
</cfquery>

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.
0
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:  
/w:document/w:body[1]/w:tbl[1]/w:tr[1]/w:tc/*[1]

This does not work:
/w:document/w:body[1]/w:tbl[1]/w:tr[1]/w:tc/*[1][attribute::text()]
nor this
/w:document/w:body[1]/w:tbl[1]/w:tr[1]/w:tc/*[1].text()
nor this
/w:document/w:body[1]/w:tbl[1]/w:tr[1]/w:tc/*[1].HtmlText()
TheDocumentXML.txt
0
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
            *
      from
            Portrait
</cfquery>



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

Any help is highly appreciated
Capture.JPG
Capture1.JPG
Capture2.JPG
0
Angular Fundamentals
LVL 12
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

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.
EE_CFM_XML_DB.txt
TheDocument.docx
0
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
0
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...

http://ahlefacademicbeta.scholarshipapps.org/app_enroll2.cfm

Open in new window

1
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...

<cfcomponent>
<!--- 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>

<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>

<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 …
0
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).
0
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#">
</cfinvoke>


<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>
      </cfloop>

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

Create 2 excel files at once

I use this to create a single excel file:

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

<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).

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

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.

Regards,
Max
0
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:
https://www.bennadel.com/blog/767-new-coldfusion-error-form-entries-incomplete-or-invalid.htm

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

Can you help?
0
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();
}; 


createFolder(saveFolder)



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

0
CompTIA Network+
LVL 12
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

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">
<HTML LANG="EN-US">

<head>
<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();
}
MM_reloadPage(true);
</script>

<link href="../css/home.css" rel="stylesheet" type="text/css" />
<LINK rel="Home" title="Index page of FINCEN Intranet site"
      type="text/html"
      href="https://<cfoutput>#CGI.SERVER_NAME#</cfoutput>">  
</head>

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

Open in new window

0
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!
0
I am getting an error when trying to run a SQL query/report from within a cfm file. The error is being throw due to the fact that there's no data to pull from for one of the options in the drop down menu for the last couple of years. No information to pull from. Any ideas on how to fix the query or CF to prevent the error when there's  no data to pull from in the db?

Error and queries below:

The error occurred in D:/inetpub/wwwroot/CASAPay/casapay_out.cfm: line 116
 
114 :                   
115 : <!--Summing columns with CFSET declaration... -->                  
116 : <cfset countttl = #invcounts.15Count# + #invcounts.1530C# + #invcounts.30plusC#>
117 : <cfset dollarttl = #invcounts.less15days# + #invcounts.15to30Days# + #invcounts.30plusDays#>
 

<cfcomponent>
	<cffunction name="casapay1" access="public" returntype="query">
 
<!--Set global datasource variable -->
<cfset #dsn# = "mirrepuser">

<cfparam name="form.agency" default="">
<cfparam name="form.period" default="">

<cfquery name="invCounts" datasource="#dsn#">
SELECT
   /*+ INDEX (f FV_INV_SELECTED_DUEDATE_IDX) */
   --Within 15 days
   SUM(
   CASE
      WHEN
         P.ACCOUNTING_DATE BETWEEN i.terms_date AND i.terms_date + 15 
      THEN
         i.invoice_amount 
      ELSE
         0 
   END
) "less15days", SUM(
   CASE
      WHEN
         P.ACCOUNTING_DATE BETWEEN i.terms_date AND i.terms_date + 15 
      THEN
         1 
      ELSE
         0 
   END
) "15COUNT", 	--Between 15-30 Days
   SUM(
   CASE
      WHEN
      

Open in new window

0
How to Detect Traffic From China language hu-hu (reported in google analytics) and divert to a not available in your region page

I notice traffic with language hu-hu in my google analytics with a high bounce rate.

What is the best way of detecting traffic from China -   with language hu-hu?

I have a cold fusion 2016 site.  Thank you
0
Create multiple PDF using coldfusion and cfcontent. I have the CF query and I need for each person generate the PDF file. The way I do is cfoutput through the query into the variable and then put that variable into cfdocument and then use <cfcontent to produce PDF through the browser. But the broser only producing the PDF for 1 person . I think this is because cfcontent but how can i produce as many PDFs  as people produced by the query  

<cfoutput query="rc.getResultByCompetency" group="rateeID">
    	<cfsavecontent variable="output">
               output here
       </cfsavecontent>
<cfdocument
						name="certificate_#rateeID#"
						orientation ="portrait"
						mimetype="application/pdf" overwrite="true" 
						format="PDF">
					#output#
				</cfdocument>		
	<cfset test = evaluate("certificate_#rateeID#")>
				<cfheader name="content-disposition" value="attachment;filename=#rc.getResultByCompetency.rateeName#.pdf">
				<cfcontent type="application/pdf" variable="#toBinary(test)#" >	
 </cfoutput>

Open in new window

0
I'm attempting to use the following code to upload files in Redactor. The directory path exists. The permissions for the directory are currently overly permissive just for testing. But the file upload box keeps turning red and no file is uploaded. Any ideas where I might be going wrong? Thanks!

Code from the index page:
<script>
  	$R('.redactor', {
		fileUpload: 'js/redactor/file-upload.cfm'
	});
</script>

Open in new window



Content of file-upload.cfm:
<cfsetting enablecfoutputonly="true">

<cfset relativePath = "/modules/downloads/">
<cfset dir = ExpandPath(relativePath)>
	
<cfset files = {}>
<cfif StructKeyExists(FORM, "file")>
	<cfset fileNumber = 1>
	<cfloop list="#FORM.file#" index="i">
		<cffile action="upload" destination="#dir#" nameconflict="makeunique" filefield="file">

		<cfset files["file-"&fileNumber]["name"] = cffile.serverFile>
		<cfset files["file-"&fileNumber]["url"] = relativePath & cffile.serverFile>
		<cfset files["file-"&fileNumber]["id"] = CreateUUID()>
		<cfset fileNumber = fileNumber + 1>
	</cfloop>
<cfelse>
    <cfset files["error"] = "no file uploaded">
    <cfset files["path"] = dir>
</cfif>
<cfheader name="Content-Type" value="application/json">
<cfoutput>#serializejson(files)#</cfoutput>
<cfsetting enablecfoutputonly="false">

Open in new window

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.

Top Experts In
ColdFusion Language
<
Monthly
>