I have a web application that creates writes text string of data to be used by 
a VB application and streams it to a file to be saved on the end user's 
computer.  

I am generating a text file from an online database that needs to be opened by 
the VB application with a CHR(10) character delimeter between fields.  The end 
user clicks "download" in my application and then saves the file to their 
computer to use with the VB application (3rd party written).  Here is an 
example of my code.  When opening the text file locally, it alway's has a new 
line character at the top of the file which chokes the VB program.  Any 
suggestions on an alternate way of doing this?  Even hardcoding the line "this 
is a test" in the cfsavecontent statement causes the /n character to be 
inserted at the top of the file. In the real application the text string is 
"#fname# & CHR(10) & #lname#" etc. 
Thanks, in advance - Dawn

<!---
Store the text you want to stream. --->

<cfsavecontent variable="strText">
This is a test.
</cfsavecontent>
 

<!--- Set the header info to force that file attachment. --->
<cfheader
name="Content-Disposition"
value="attachment; filename=test.txt"
/>
 

<!---
Stream the text. To do so, we have to convert it to
Base64 first, then convert that to binary.
--->
<cfcontent
type="text/plain"
reset="true"
variable="#ToBinary(ToBase64(strText))#"
/> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341012
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to