• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Server content-type setting for PDF

B

bhemesath

Guest
I migrated a PHP-based site from Plesk 6.x (PHP 4.3.3) to a brand new plesk 7.5 box (PHP 4.3.9).

One part of the site offers files to be downloaded indirectly. By indirectly, I mean the URL doesn't give away the location of the file. I.e., http://site.com/file.php?id=203

This worked fine on the old box for all file types (pdf, doc, jpg, etc).
The new server does not like the PDF file type (or probably my code). doc and jpg file types are OK.

When an end-user clicks the link on the public site, it opens the new window, the Adobe splash screen appears as if the PDF is opening, and then an alert box appears: "The file is damaged and could not be repaired."

In my php code, I start the header with this:
header("Content-type: application/pdf");
(and optional) header('Content-Type: application/octet-stream');


Now, if I change my php code to this:
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=test.pdf");

It will allow me to Save the PDF and open it.

Any thoughts? Thanks in advance-
 
Back
Top