Connecting Tech Pros Worldwide Help | Site Map

cfheader: file not found

Member
 
Join Date: Jan 2008
Posts: 113
#1: Sep 8 '08
Hi there,

I've been trying to implement a csv file download with the following code:

Expand|Select|Wrap|Line Numbers
  1.       <cfheader name="Content-Disposition" value="attachment;filename=thefile.csv">
  2.       <cfcontent type="application/csv" deleteFile="No" file="theFile.csv">
  3.       <!--- Data ouput code goes here --->
  4.       </cfcontent>
  5.  
But a page load error occurs stating the file cannot be found? When I change the cfheader value to inline;filename=theFile.csv the file displays but doesn't prompt for a download? Could someone point out where I am going wrong please?

Thanks,

Chromis
Member
 
Join Date: Jan 2008
Posts: 113
#2: Sep 8 '08

re: cfheader: file not found


Quote:

Originally Posted by chromis

Expand|Select|Wrap|Line Numbers
  1.       <cfheader name="Content-Disposition" value="attachment;filename=thefile.csv">
  2.       <cfcontent type="application/csv" deleteFile="No" file="theFile.csv">
  3.       <!--- Data ouput code goes here --->
  4.       </cfcontent>
  5.  

The answer was in the file attribute of the cfcontent tag. The new code is as follows:

Expand|Select|Wrap|Line Numbers
  1.       <cfheader name="Content-Disposition" value="attachment;filename=thefile.csv">
  2.       <cfcontent type="application/csv">
  3.       <!--- Data ouput code goes here --->
  4.       </cfcontent>
  5.  
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Sep 8 '08

re: cfheader: file not found


If you're specifying a file attribute for cfcontent, it needs to be the full path.
Member
 
Join Date: Jan 2008
Posts: 113
#4: Sep 11 '08

re: cfheader: file not found


Thanks acoder I'll remember that.
Reply


Similar ColdFusion bytes