Amit Patil
Amit Patil

Reputation: 3067

Force file download PDF 'open with' box says its a Firefox document ??

I am trying to force download a PDF file, Everything works fine. Only problem is when it show a "Download box" it says its a "Firefox Document" which actually should say "Adobe Acrobat Document". See the images, and below is the code i am using

1) Force download box from gmail, which works fine

enter image description here

2) Force download box from my application, which says "Firefox Document"

enter image description here

  header("Pragma: public"); 
  header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
  header("Content-Type: application/pdf"); 
  header("Content-Disposition: attachment; filename=\"".basename($file)."\";" ); 
  header("Content-Transfer-Encoding: binary"); 
  header("Content-Length: ".filesize(getcwd().$file)); 

  readfile(getcwd().$file); 

Upvotes: 1

Views: 1825

Answers (2)

Arthur Kielbasa
Arthur Kielbasa

Reputation: 106

for everyone who is searching for the same issue.

the TS go the solution :

add exit @ the end (for some reasons firefox needs this)

header("Content-Type: application/pdf");
echo $pdf;
exit;

Upvotes: 1

Red October
Red October

Reputation: 689

Try to use

Header('Content-Type: application/octet-stream');

instead of

Header("Content-Type: application/pdf"); 

Upvotes: 1

Related Questions