2 Replies Latest reply on Sep 27, 2011 6:39 AM by wmkolcz

    Force downloading page name, not file name...

    wmkolcz

          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" />