Copy link to clipboard
Copied
Hi all
I am using cf header to display a dynically generated report as a word doc. At least this is my goal
i'm using mx7 on appache 2.0 and Firefox 2.0.0.16 [i can not update this] and ie 6 sp 3 for browsers.
no matter how a set this up i don't get the expected results
<cfheader name "content-disposition" value="attachment;filename=#GetInspection.file_number#.doc">
<cfcontent type="application/vnd.msword">
in Firefox the file always downloads as a cfm file. I cant change this.
in ie it down loads as a cfm file but if i elect to save it i can select word.
the other issue with both browsers is that it will not take on the file name assigned it the cf header tag. It just uses the template name.
anyone have a suggestion?
tia
J
Copy link to clipboard
Copied
The equality sign is missing for the name attribute. I also think you have to include the file attribute in cfcontent.
For example, suppose I have stored the file MyFileName.doc in the web root. When the user opens the page I want the file that is displayed to be named SomeOtherFileName.doc instead. Then some possibilities are:
1) to download and save file
<cfset
GetInspection.file_number="SomeOtherFileName">
<cfheader
name ="Content-Disposition" value="attachment;filename=#GetInspection.file_number#.doc">
<cfcontent
type="application/msword" file="C:\ColdFusionCentaur\wwwroot\MyFileName.doc">
2) to open and view file in the browser
<cfset
GetInspection.file_number="SomeOtherFileName">
<cfheader
name ="Content-Disposition" value="inline;filename=#GetInspection.file_number#.doc">
<cfcontent
type="application/msword" file="C:\ColdFusionCentaur\wwwroot\MyFileName.doc">
Copy link to clipboard
Copied
Thank you for your reply.
The template is report_draft.cfm, and is used for mulitple inspection reports, so the name of the report when downloaded has to be inspection file number.doc.
I have tried your suggestions and i am still having the same issues. So,the report_draft.cfm template is made up of 20 + includes, one for each section of the report. Should this have an impact on how the CFheader/CFcontent performs?
thanks
J
Copy link to clipboard
Copied
you may also want to add a reset="true" to your <cfcontent...> tag so that all that white space generated by all that CFML in all those includes does not throw the browser off.
<cfcontent reset="true" type="application/msword"...>
Copy link to clipboard
Copied
... the report_draft.cfm template is made up of 20 + includes, one for each section of the report. Should this have an impact on how the CFheader/CFcontent performs?
No. If your page serves CFM code, then it probably means your Apache configuration is incomplete. Follow the instructions to configure and verify Apache . Note, in particular, step 5!