Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving a streamed RTF file to server - not outputting it to browser

Status
Not open for further replies.

ccnzhibis

Programmer
Jun 17, 2008
2
I have a Word document, which I need to dynamically produce for my customers. I saved the word document as an RTF file, uploaded that to the server, and then wrote the attached code to get the RTF version of the document. When I load the URL, IE asks me to save the file. I don't wish to do this. This URL will hit by automatically by my website, and I want to name the resulting RTF file and be able to save it in a desired location on the server.

The RTF contains some very small <cfoutput> information.

How can I do this?

Code:
<cfheader name="Content-Type" VALUE="application/rtf">
<cfheader name="Content-Disposition" value="attachment; filename=q_print.rtf">
<cfcontent type="application/rtf"><cfinclude template="Investment_Strategy.rtf">
 
You've written code to serve an RTF file to the client. This usually means a Web browser client. If the client hasn't mapped an application to the RTF extension, you get the expected "Save As" behavior.

When you say "This URL will hit by automatically by my website", do you mean you're doing a CFHTTP GET to retrieve the results?

I don't understand the flow of this appication. If the file is already on the server after you created the RTF, why don't you just do a CFFILE COPY and RENAME to put the new file where you want it?

Phil H.
Some Bank
-----------
Time's fun when you're having flies.
 
Yes I've realised I was kind of in the wrong direction. I could do what you suggested, but I have <cfoutput> code in my RTF file that I need to somehow execute. If I just do a straight copy on the master RTF then the CF code in it doesn't run at all. WHat I've ended up doing is doing a cffile write with the whole RTF in the "output" of the cffile. It's a bit messy, and I can't do any CFIF's or anything because the final RTF file has all the CF code still in it - but the RTF file seems to recognise #blah# and seems to process those.

I would like a much better and cleaner solution though.
 
If your goal is the creation of a "clean" RTF, you should write CF that outputs the final result, with no CF code left in the result, only RTF.

Good luck!

Phil H.
Some Bank
-----------
Time's fun when you're having flies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top