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

Force downloading page name, not file name...

Explorer ,
Sep 27, 2011 Sep 27, 2011

    I need some help and I think I tapped Google out as much as I can. I am attempting to write out a cvs file, then force download it. The csv generates fine, but when it comes to serving up the file as a download, it serves the name of the page instead. So rather than '10Adopt-Addresses.csv', it serves up 'addresses.cfm' with the information writen to it. I posted the code below. Thanks! 

<cfset addresses = createObject("component","com.mywebsite.adopt.adoptGateway").listAddresses(#url.orgID#) />

        <cffile action="write" file="#ExpandPath('\')#com\mywebsite\files\#url.orgID#Adopt-Addresses.csv" output="firstname,lastname,address,city,state,zip,country" addnewline="Yes">

        <cfoutput query="addresses">

            <cffile action="APPEND" file="#ExpandPath('\')#com\mywebsite\files\#url.orgID#Adopt-Addresses.csv" output="#firstname#,#lastname#,#address#,#city#,#state#,#zipcode#,#cntry#" addnewline="Yes">

        </cfoutput>       

        <cfheader name="Content-Disposition" value="#url.orgID#Adopt-Addresses.csv" />

        <cfcontent file="#ExpandPath('/')#com/mywebsite/files/#url.orgID#Adopt-Addresses.csv" deletefile="true" type="application/csv" />

TOPICS
Advanced techniques
608
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

Community Expert , Sep 27, 2011 Sep 27, 2011

<cfheader name="Content-Disposition" value="attachment; filename=#url.orgID#Adopt-Addresses.csv" />

Translate
Community Expert ,
Sep 27, 2011 Sep 27, 2011

<cfheader name="Content-Disposition" value="attachment; filename=#url.orgID#Adopt-Addresses.csv" />

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
Explorer ,
Sep 27, 2011 Sep 27, 2011
LATEST

Thanks! Just what I was missing! Worked like a charm.

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