[thelist] Force download in ColdFusion?

Joe Crawford jcrawford at avencom.com
Thu Feb 22 15:15:29 CST 2001


Pete Prodoehl wrote:
> In perl I've used the following hack:
> 
>   #!/usr/local/bin/perl
>   open (FILE, "/path/to/file");
>   local ($/);
>   $file = <FILE>;
>   close (FILE);
>   print "Content-type: application/x-unknown\n";
>   print "Content-Disposition: attachment; filename=file.tsv\n";
>   print "Content-Description: This is a tab-delimited file.\n\n";
>   print $file;
> to present a "Save As..." dialog box and force the download of a file,
> rather than have it displayed within the browser.
> I'm looking for a way to do the same thing in ColdFusion, can anyone provide
> pointers or a sample?

How about something like this:
<cfcontent type=application/x-unknown">
<cfheader name="Content-Disposition" value="attachment;
filename=file.tsv">
<cfheader name="Content-Description" value="This is a tab-delimited
file.">
<cflocation url="#file#">

--- but that's just a guess.

	- Joe
--
Joe Crawford ||||||||||||||       mailto:jcrawford at avencom.com
||||||||||||||||||||||||             http://www.avencom.com
|||||||||||||||||||||||||||      Avencom: Set Your Sites Higher




More information about the thelist mailing list