• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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