Jump to content
Larry Ullman's Book Forums

Force Pdf Download?


Recommended Posts

I just finished the content chapters in the first part of the book. I have just made it to page 136, Using Paypal.

 

When I left click on the links in view_pdf.php it opens acrobat ready in my browser. I wonder if there is away to open a download save as dialog box instead of acrobat reader?

Yes, I can right click and save as but is there a way to force that save dialogue popup on left click?

Link to comment
Share on other sites

You can force a File Download dialog by sendng the proper http headers:

header ("Content-Type: application/pdf\n");
header ("Content-disposition: attachment; filename=\"$filename\"\n");
header ("Content-Length: $filesize\n");
readfile ($full_path_to_file . $filename);

Downloading files is covered in Larry's PHP and MySQL for the World Wide Web editions, in the Content Management chapter.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...