Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfcontent + pdf, IE and mx 7.0.1

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
Has anyone come across something like this:

I have a pdf file that i want to be able to deliver to the user, by the click of a button.
When this button is clicked i get the file from the directory, and deliver it to the user using cfcontent.

this is the code for the cfcontent:

<cfheader name="Content-Type" value="Unknown">
<cfheader name="Cache-Control" value="private">
<cfheader name="Content-Disposition" value="Attachment;Inline;Filename=#qryFile.OriginalFileName#">
<cfcontent type="Application/Unknown" file="#FileDeliver#" deletefile="No">
<cfabort>

this code will pop up with the open/save option within IE. It works if i say save, and save the document and then open it. if i say open, it does something and then opens PDF viewer and then throws an error saying it can't open the file as it can't be found.

doing the same thing in firefox/other browser works. Anyone come across this/know a fix?

TIA

Tony
 
I haven't had that experience, but why deliver it as CFCONTENT and not just a hyperlink? That way, the each individual user's browser will handle the PDF correctly. If they want to save a local copy, they'd have the option to do that as well. However, it's not my place to question your methods. My boss gives me ridiculous requests every day! :)

Kevin
 
KevinFSI, one reason may be that he wants to only allow access to the PDF to specific users and has it stored in a non-web accessible place.

DeadlyViper I notice that you have both attachment and inline in the content-disposition header - i'm not sure if this is corret. I've certainly only ever used one or the other and RFC2183 seems to confirm this:


I've always used attachment to ensure that it can be downloaded and an unknown mime type (as you have done) to prevent it being automatically opened. Finally trying setting the reset attribute of cfcontent to Yes to ensure no whitespace or already rendered content is messing with the browser.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top