Re: same content different result CFFile vs CFContent

2011-03-15 Thread Mack

First, make sure that cfsavecontent doesn't introduce any spaces:
cfsavecontent variable=strTextcfoutput#myFile#/cfoutput/cfsavecontent

Second, I would include the file name in quotes in the
Content-Disposition header: cfheader name=Content-Disposition
value='attachment;
filename=#userInfo.lName#-#userInfo.fName#-#userInfo..UserID#-FI.txt'

Third, just output the variable in the cfcontent tag, there's no need
to pass through base64

-- 
Mack

~|
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:343031
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


same content different result CFFile vs CFContent

2011-03-14 Thread Dawn Sekel

I am converting some code that originally used CFFILE to write the contents of 
a variable to a file on the server and then attached it to an email and 
emailed.  For security reasons, we have switched to https:// and are providing 
a link for an authenticated user that takes the contents of the variable and 
generates an inline file for the user to download.  The new version however, 
contains a single ASCII character 32 (space) at the end – while the older 
version did not.  Would anyone be able to compare the to versions of my code 
and see if they can identify why the space is being added?  It is the very last 
character of the file.  Thanks in advance for any advice.  Dawn

The original code was:
!--- Create File ---
cffile action=write addnewline=no 
file=#GetDirectoryFromPath(ExpandPath(*.*))##userInfo.LName#-#userInfo.FName#-#userInfo.UserID#-FI.txt
 output=#myFile#
The new code is
!--- Create File ---
cfsavecontent variable=strText
cfoutput#myFile#/cfoutput
/cfsavecontent
 !--- Set the header info to force that file attachment. ---
cfheader
name=Content-Disposition
value=attachment; 
filename=#userInfo.lName#-#userInfo.fName#-#userInfo..UserID#-FI.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:343000
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm