  | |  | CFCONTENT and CFHEADER working from Actionscript getURL, but not f | CFCONTENT and CFHEADER working from Actionscript getURL, but not f 2004-03-11 - By Craig Earls
Back I am storing a grunch of files of different types in a directory on my server. For obscurity (don't ask it's a legal thing) I store them with names like DOC_**.AAF Where the ** is an id number. I store the mime type and orignal filename in a database table. My Flash application calls a coldfusion template called download.cfm with a URL variable with the document id number. The template looks up the data in the data base and sends a page back with CFHEADER and CFCONTENT set to download the appropriate file with the correct filename. This works in both Netscape and IE when called from Flash using getURL and a javascript call to pop up an undecorated window.
If I call the same page using an anchor from an HTML page it doesn't work. IE tries to name the file "download.cfm?document_id=**" and can't find the file to download. It is as if the CFCONTENT and CFHEADER were being ignored. I have check to verify that they are getting good values.
Here is the code from download.cfm:
<cfif metadata.recordCount GT 0> <cfset localfilename="#GetDirectoryFromPath(GetBaseTemplatePath())#storage\DOC_#URL .document_id#.aaf"> <cfheader name="content-disposition" value="attachment;filename=#metadata.file_name#"> <cfcontent type="#metadata.contenttype#/#metadata.contentsubtype#" file="#localfilename#"> </cfif>
Can anybody explain why this technique works fine when called using Actionscript
getURL("http://"+server+"/Users/download.cfm?document_id=" + documentObj.document_id);
But this HTML won't:
<a href="http://www.mydomain.com/Users/download.cfm?document_id=**" >The Real Filename.ext</a>
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:106713 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |