This maybe a "noobie" type of answer...
BUT, could you not have the link in the email direct them to a page that makes
an AJAX call to a script that does your tracking...
then use javascript to redirect them directly to the PDF document without using
cfcontent (perhaps thats where the error is coming from) ?
This of course would bring up the PDF document, so the users would have to know
to Save a Copy..
Another thing you could do would be to have that page that makes the AJAX call
display a link to the file with instructions on how to save ("To Download,
Right-click and choose Save As...")
Hope this helps...sorry if it doesn't :-\
___________________________
John Youngman
[EMAIL PROTECTED]
----- Original Message -----
From: Clarke Bishop
To: [email protected]
Sent: Thursday, May 01, 2008 10:02 AM
Subject: [ACFUG Discuss] Best way to download a PDF file
I have a 2 MB PDF that I get's downloaded via a CFM page so that I can do
some tracking of who downloads the page.
It seems there are two ways to make this work:
#1
<cfcontent type="application/pdf" file="myFile.pdf" reset="yes">
Normally, this would just open the PDF in the browser.
- OR -
#2
<cfheader name="Content-Disposition" value="attachment; filename=myFile.pdf">
<cfcontent type="application/pdf" file="myFile.pdf" reset="yes">
This prompts the user whether they want to save or open the document.
Here are my questions:
1. My client thought that some users would not know how to click the save
icon in the Adobe Reader plug-in to save the PDF to their local drive. So,
option 2 would be better as it give them the choice. But, my users are coming
to the page from a link in an email and option 2 leaves open a blank web
browser after the open/save dialog. This might be confusing, too. Is there
another option that will work better? Can I download the page and then redirect
them to a download complete page? Or, maybe I should send them to a landing
page from the e-mail link and then let them download from there?
2. With either option, sometimes the file fails to fully download, and the
PDF displays with an error message:
"There was an error opening this document. The file is damaged and could not
be repaired"
I added <cfsetting requestTimeOut="600"> To try and prevent this problem.
But, somewhere I saw that the requestTimeOut doesn't apply to CFContent, so I'm
not sure this really helps.
The problem was hard to duplicate since it seems to be bandwidth-dependent.
So, I turned on throttling in Charles, and selected a 56K modem to force low
bandwidth. It seems to download consistently for about 2 minutes (About 25% of
the 2MB file), and then just hangs for about 4.5 minutes and produces the
error. I removed the <cfsetting> tag and got essentially the same behavior --
It goes for 2 minutes, then hangs for
Once I deploy this, I expect thousands of downloads, and I don't want to have
to handle a bunch of support calls.
Any ideas on how to best handle the user interface and prevent this download
timeout would be very much appreciated.
Clarke
-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink
-------------------------------------------------------------
-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------