Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFContent Situation

Participant ,
Feb 25, 2009 Feb 25, 2009
Hello community!

I am working on an export file which is a pipe (|) delimited file and I am running into some issues. First of all the file is not being generated with the file name that I am specifying. Second, I am getting a ton of HTML in addition to my data in my generated file. I want a clean export -That is only the data from my query. This export is for a third party product that we use in my company.

This is where I generate the file:

<cfcontent type="text/plain">
<cfheader name="Content-Disposition" value="\\development\webdata\retail\cigars\filename=famoussmoke_#timeNow#.txt">
<cfoutput>
<br />
<cfloop query="getFields">

#adr#|#fname#|#lname#|#zip#|#ordnum#|#tot_goods#|#suppflgs#<br />

</cfloop>
</cfoutput>
Can somebody provide me with some assistance?

Thanks!
TOPICS
Advanced techniques
713
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Feb 25, 2009 Feb 25, 2009
Things to try:

For a text file use Chr(13) & Chr(10) instead of a BR tag.

You will also need to remove whitepace prior to your content by using reset="yes" in your CFCONTENT tag. Also remove any whitespace such as line breaks after your CFCONTENT tag.

I think your CFHEADER tag is also a problem. Are you trying to download the text to your browser or save it to a file share?

Edit: Modified code sample.
Translate
Advisor ,
Feb 25, 2009 Feb 25, 2009
Things to try:

For a text file use Chr(13) & Chr(10) instead of a BR tag.

You will also need to remove whitepace prior to your content by using reset="yes" in your CFCONTENT tag. Also remove any whitespace such as line breaks after your CFCONTENT tag.

I think your CFHEADER tag is also a problem. Are you trying to download the text to your browser or save it to a file share?

Edit: Modified code sample.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2009 Feb 25, 2009
First, I *think* you want to put the <cfheader> before the
<cfcontent...> tag, but I am not user.

But definatly, if you do not want HTML in your output, don't put it
there! You are formating you content as HTML with <br/> and such, but
then telling the browser that it is not HTML with the type="text/plain".
Go one way or the other, don't mix the message.

<cfheader
name="Content-Disposition"
value="\\development\webdata\retail\cigars\filename=famoussmoke_#timeNow#.txt">
<cfcontent type="text/plain">
<cfoutput
query="getFields">#adr#|#fname#|#lname#|#zip#|#ordnum#|#tot_goods#|#suppflgs#
</cfoutput>


NOTE: It is very hard to experss in this email, but since you are
saying this output is plain text, not HTML, then all white space is
going to count. So you will have to be very careful with what you put
in and around your <cfoutput...> tags. They will show up!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 26, 2009 Feb 26, 2009
Ok, let me try the other way around and I will post in here how it goes!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 25, 2009 Feb 25, 2009
Hi JR!

Yes, I want to download the file to my desktop. It's not being downloaded with the name I specified though..........See cfheader tag...Thanks soooo much!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Feb 25, 2009 Feb 25, 2009
See attached sample. Note that the attachment value for Content-Disposition is only recognized by some browsers, such as Internet Explorer.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 27, 2009 Feb 27, 2009
LATEST
The problem was here:

value="attachment;filename=famoussmoke.txt"

I didn't have the word attachment in the value paramater.

Thank you guys! Your feedback and support were awesome!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources