Hi All,

I've been playing around with using an autodownload routine for pdf's, as
others have suggested in this forum.

Here's the problem - In Netscape, both the open and save dialog buttons work
correctly (document can be saved, then opened on a users machine - also,
opening directly works as well).  However, in IE 6, the document can be
saved to the client machine and opened OK.  However, clicking the "open"
button in the IE dialog throws a message in Acrobat 6 that the file cannot
be found.

You can try it directly at this URL to see what I mean:

http://www.drchuckpowell.com/free/

What's causing this? (I've only tested this in Windows)

Here's the code:
=======================
<!--- Set where the calling page is coming from (pn = pagename)--->
<cfswitch _expression_="#URL.pn#">
<cfcase value="fs"><!--- Free Stuff Page --->
<cfset VARIABLES.dlfilepath =
"#REQUEST.downloadFiles#freeArticles\"><!--- Set the download file locations
--->
</cfcase>
</cfswitch>

<cfscript>
VARIABLES.fileTypeExt = Right(URL.articleDirectURL, 3); // Determine the
file type of the document being called
VARIABLES.filePath = "#VARIABLES.dlfilepath#";
VARIABLES.fileName = "#URL.articleDirectURL#";
VARIABLES.headervalue = "attachment";
</cfscript>

<cfif VARIABLES.fileTypeExt EQ "pdf">
<cfset VARIABLES.FileType = "pdf">
<cfelse>
<cfset VARIABLES.FileType = "unknown">
</cfif>

<cfset VARIABLES.BadType  = "-#FileType#-"> <!---  Make an Invalid Mime Type
--->

<!---
<cfoutput>
#VARIABLES.fileTypeExt#<br />
#VARIABLES.FilePath#<br />
#VARIABLES.FileName#<br /><br />
#VARIABLES.filepath##VARIABLES.fileName#<br />
</cfoutput>
<cfabort>--->

<!--- DownLoadFile.cfm  --->
<cfsetting enablecfoutputonly="yes">
<cfoutput>

<cfif ReFind("MSIE",cgi.HTTP_USER_AGENT)> <!---  If IE --->
<!--- <cfheader name="content-type"
value="application/#VARIABLES.fileType#"> --->
<cfheader name="Content-disposition"
value="Attachment; filename=#VARIABLES.fileName#">
<cfcontent type="application/octet-stream"
file="#VARIABLES.filepath##VARIABLES.fileName#">

  
<cfelse>  <!--- If Netscape  --->
<cfheader name="content-type"
value="application/octet-stream">
<cfheader name="content-disposition"
value='Attachment; filename="#VARIABLES.fileName#"'>
<cfcontent  type="application/octet-stream"
file="#VARIABLES.filepath##VARIABLES.fileName#" >

  
</cfif>
</cfoutput>
<cfsetting enablecfoutputonly="no">
<cfabort>

===========================

Thanks, Mark
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to