My application streams pdf files from disk (not zodb) to the user, and I've been writing the http header more or less manually. I've had some strange problems with downloading - one particular third-party pdf plugin acts as if the file can not be found, and Internet Explorer arbitrarily, yet consistently pops the Open/Save/Cancel dialog for 1% of files, while launching a plugin for the other 99%. My header looks like this: HTTP/1.1 200 OK Server: Zope/(Zope 2.7.3-0, python 2.3.4, linux2) ZServer/1.1 Date: Wed, 19 Jan 2005 17:08:30 GMT Content-Length: 20004 Content-Type: application/pdf Connection: close Content-Disposition: filename="attachment.pdf" Is there anything missing or malformed that could be causing trouble? Nathaniel _______________________________________________ CONFIDENTIALITY NOTICE This e-mail is intended only for the addressee named above. It contains information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox. Thank you for your cooperation. ID:[{20050119123043.24590.577798887-66.208.180.43}]
Nathaniel Wingfield wrote:
My header looks like this:
HTTP/1.1 200 OK
Server: Zope/(Zope 2.7.3-0, python 2.3.4, linux2) ZServer/1.1
Date: Wed, 19 Jan 2005 17:08:30 GMT
Content-Length: 20004
Content-Type: application/pdf
Connection: close
Content-Disposition: filename="attachment.pdf"
What do you want it to do? If you want the browser to display the file as PDF i.e. use a plugin if it has a plugin, then you should keep the Content-Type application/pdf and omit the Content-Disposition. If you want the browser to treat the file as unknown i.e. display a download box, then you should change the Content-Type to application/octet-stream and the Content-Disposition to Content-Disposition: attachment; filename="attachment.pdf" At least that works for me. Robert
On Wed, 19 Jan 2005 12:24:25 -0500, Nathaniel Wingfield <NWingfield@dixon-hughes.com> wrote:
My application streams pdf files from disk (not zodb) to the user, and I've been writing the http header more or less manually. I've had some strange problems with downloading – one particular third-party pdf plugin acts as if the file can not be found, and Internet Explorer arbitrarily, yet consistently pops the Open/Save/Cancel dialog for 1% of files, while launching a plugin for the other 99%.
My header looks like this:
HTTP/1.1 200 OK Server: Zope/(Zope 2.7.3-0, python 2.3.4, linux2) ZServer/1.1 Date: Wed, 19 Jan 2005 17:08:30 GMT Content-Length: 20004 Content-Type: application/pdf Connection: close Content-Disposition: filename="attachment.pdf"
Is there anything missing or malformed that could be causing trouble?
I had this problem with PHP powered site. IE would always ask to save and never display with the plugin. Even when the headers were identical it wouldn't work, but everything other than IE worked. I just ended up serving directly with Apache. A quick thing first, the Content-Disposition header should look like this: Content-Disposition: inline; filename="attachment.pdf" to make IE display in the PDF plugin. -- Phillip Hutchings http://www.sitharus.com/ sitharus@gmail.com / sitharus@sitharus.com
participants (3)
-
Nathaniel Wingfield -
Phillip Hutchings -
Robert Casties