Jump to content

Recommended Posts

Originally I posted this in the php help, but no one seems to have any answeres so here is the original post:

 

Hi, Im having some problems with the passthru function. When I just have the passthru fuction like this

 

header( \'Content-Type: application/pdf\' );

header( \'Content-Location: /local/relateive/pathname/agian/correct.pdf\' );

$fh = fopen(\"/correct_fullSystemPathname/yep/double/checked.pdf\", \"r\");

fpassthru($fh);

 

This is the only thing in my file. When I add the session start

 

session_start();

header(\"cache-control: private\");

 

at the beggining where it belongs, the passthru ceases to work. Instead of bringing up the pdf in the browser, like it was doing before the sessions, it asks for a download. However when you select to download it just says it is unable to open from the web site. It appears its trying to open the php file rather than letting the server \"serve the output\" of the php file.

 

Ok any help would be greatly appreciated.

 

Addition:

 

Continuing to play with this thing I have found that the correct file is being called, and the download is initiallizing correctly... in fact by tricking the browser I could actually view the binary for the pdf that was being passed. The problem must be in the way the file is being presented. Probably some header I am missing. Any Ideas?

 

Thanks for any help!!!

Link to comment
https://forums.phpfreaks.com/topic/1542-passthrusession-incompatability/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.