• My erro log shows an error when users try to access a PDF file.
    I have uploaded the file to an UPLOAD folder wp-content/uploads/2014/01/gwcc-bylaws.pdf. I get this error in the log:

    [09-Mar-2014 23:52:38 America/Denver] PHP Warning: readfile(www.gwcc.org.nz/wp-content/uploads/2014/01/gwcc-bylaws.pdf): failed to open stream: No such file or directory in /home4/thefarmn/public_html/gwccorg/gwcc-bylaws.php on line 10

    my php file:
    <?php
    header(“Pragma: public”);
    header(“Expires: 0”);
    header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
    header(“Cache-Control: private”,false);
    if (true) { // (!Operating_System_Is_IOS)
    header(“Content-disposition: attachment; filename=gwcc-bylaws.pdf”);
    }
    header(“Content-type: application/pdf”);
    readfile(“www.gwcc.org.nz/wp-content/uploads/2014/01/gwcc-bylaws.pdf”);

    ?>

    When I test it seems to work.
    In other places on my site I think I just insert an hyperlink to the file instead of using the PHP for access. When I test (PC / Windows XP chrome) both seems to work.

    Any help would be appreciated. Is it the PHO file? Do I need to do something special for different browsers? different OS? Should the URL be replaced with a directory/file location instead?

    Thanks.

  • The topic ‘PDF File Read error’ is closed to new replies.