{"id":444,"date":"2011-01-19T10:15:55","date_gmt":"2011-01-19T15:15:55","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=444"},"modified":"2011-01-19T10:15:55","modified_gmt":"2011-01-19T15:15:55","slug":"coldfusion-output-to-txt-file","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2011\/01\/coldfusion-output-to-txt-file\/","title":{"rendered":"Coldfusion Output to .txt file"},"content":{"rendered":"<p>A couple of methods I use to output a file from the browser to .txt.<\/p>\n<p>Write your query as normal. Then use one of the two output methods below.<\/p>\n<p>CF8 &#8211; Output as comma delimited with quotes. Note, without quotes the line does not break properly.<br \/>\n<code>&lt;cfcontent type=\"text\/plain\"&gt;<br \/>\n&lt;cfheader name=\"content-disposition\" value=\"attachment;filename=yourfilename.txt\"&gt;<br \/>\n\"Header-numericfield\",\"Header-alphafieldname\"<br \/>\n&lt;cfoutput query=\"queryname\">#numericfield#,\"#alphafieldname#\"<br \/>\n&lt;\/cfoutput&gt;<\/code><\/p>\n<p>CF7 &#8211; Output as tilde delimted with line wraps defined.<br \/>\n<code>&lt;cfcontent type=\"text\/plain\"&gt;<br \/>\n&lt;cfheader name=\"content-disposition\" value=\"attachment;filename=yourfilename.txt\"&gt;<br \/>\nHeader-numericfield~Header-alphafieldname~\/n<br \/>\n&lt;cfoutput query=\"queryname\">#numericfield#~#alphafieldname#~\/n<br \/>\n&lt;\/cfoutput&gt;<\/code><\/p>\n<p>It is important to note that wherever you have line breaks and spaces in your code, you will have linebreaks and spaces in your txt file. This can be a problem if users are trying to upload your data into a database. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A couple of methods I use to output a file from the browser to .txt. Write your query as normal. Then use one of the two output methods below. CF8 &#8211; Output as comma delimited with quotes. Note, without quotes &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2011\/01\/coldfusion-output-to-txt-file\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16,24],"tags":[],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-code","category-coldfusion","category-snippets-quick-code-tips-for-single-elements-attributes-or-details"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}