SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Oct 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Launch PDF with PHP

    How to Launch PDF with PHP

    <?php

    $file = 'report-1/a35546kn-90cb.pdf';

    header('Content-type: application/pdf'); //set MIME type
    header('Content-Disposition: attachment; filename="'.$file.'"'); //set filename

    readfile($file); //dump contents of file
    ?>


    This works great.
    Last edited by r937; Oct 29, 2005 at 05:06. Reason: self-promotion

  2. #2
    SitePoint Addict timvw's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As usual, this only works if the user has configured his browser to do so...

    It is also recommended, if you know the content-length, that you send it as a header.. http://www.php.net/filesize.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •