Jump to content

atomicx6637

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by atomicx6637

  1. I have a PHP page that retrieves a PDF from a location on my server that isn't in the web server home path, for security reasons. When I try to retrieve the file on my development server everything works great, but when I try it on my account with HostGator it opens the PDF and I get an error after Adobe opens. "There was an error opening this document. The file is damaged and could not be repaired"

     

    Here is the code I'm using

     

                    $file = $file_info->file_name;
    
                    if(file_exists($file))
                    {
                            header('Content-Description: File Transfer');
                            header('Content-Type: application/mime-type');
                            header('Content-Disposition: inline; filename='.basename($file));
                            header('Content-Transfer-Encoding: binary');
                            header('Expires: 0');
                            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                            header('Pragma: public');
                            header('Content-Length: ' . filesize($file));
                            ob_clean();
                            flush();
                            readfile($file);
                    }
    

     

    when I present it with a browser that is fails.

     

    I have been racking my brain for hours. I would appreciate some help.

     

    Thanks

    Troy

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.