Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 8th, 2008, 02:17 PM
Member
 
Join Date: Jan 2008
Posts: 85
Default cfheader: file not found

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
Reply
  #2  
Old September 8th, 2008, 03:07 PM
Member
 
Join Date: Jan 2008
Posts: 85
Default

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.  
Reply
  #3  
Old September 8th, 2008, 03:27 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,727
Default

If you're specifying a file attribute for cfcontent, it needs to be the full path.
Reply
  #4  
Old September 11th, 2008, 10:04 AM
Member
 
Join Date: Jan 2008
Posts: 85
Default

Thanks acoder I'll remember that.
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles