Skip to main content
June 14, 2006
Answered

CFCONTENT Problem

I am using CFCONTENT to display an Excel file after a person clicks on the row in CFGRID. The code below is the code I am using:

<cfset filePath = "d:\Inetpub\OpptyAttachments\#getReport.oppID#\#trim(getReport.attachName)#">
<cfset apptype = #Right(getReport.attachName, 3)#>

<CFHEADER NAME="content-disposition" VALUE="inline; filename=#Trim(getReport.attachName)#">
<cfif (apptype IS 'xls') or (apptype IS 'csv')>
<cfcontent type="application/vnd.ms-excel" file="#Trim(filePath)#" deletefile="No">
</cfif>

When I try to open the Excel file I get the following error in IE:
Action canceled
Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.

If I refresh the browser the file dialoge box opens up.

This error is just for Excel files, I am not having this problem with text, pdf or images.

Any suggestions would be helpful!
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
June 15, 2006
Thanks for the help. I got the code working!

2 replies

BKBK
Community Expert
Community Expert
June 15, 2006
Test with the code below. In place of xxx put the actual value of getReport.attachName and, in place of yyy, put the actual full path to the file.

<cfheader name="Content-Disposition" value="inline; filename=xxx">
<cfcontent type="application/vnd.ms-excel" file="yyy">

If it works, then that will tell you there is an error in the evaluation of the variables.


Translate
Correct answer
June 15, 2006
Thanks for the help. I got the code working!
Translate