> When I have a physical file CFHEADER serves it fine, but when I try to serve > it from the CFFILE READ variable it don't serve. Any idea what I'm doing > wrong? > > <cfset getfile="mypath\myfile.zip"> > <cfset file_size=getFileInfo(getfile).size> > <cffile action="read" file="#getfile#" variable="serve_file"> (This > works; I can dump the file var and binary content is there) > ... would delete the file here... > > To serve the file: > <cfheader name="Content-Disposition" value="attachment;filename= > myfile.zip"> > <cfheader name="Content-Length" value="#file_size#"> > <cfcontent type="application/zip" file="#serve_file#"> (if I use the > path to the physical file this works; but it bombs with the file data in the > var server_file) > <cfheader name="Pragma" value="no-cache"> > <cfheader name="Expires" value="#Now()#"> > <cfheader name="cache-control" value="no-cache, no-store, > must-revalidate, max-age=0"> > > Anyone see what I'm doing wrong here?
The FILE attribute of CFCONTENT requires a path to a file. If you want to serve content from a variable, don't use the FILE attribute: <cfcontent type="..."><cfoutput>#toBase64(your binary content)#</cfoutput> Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353118 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

