Jump to content

Passthru/Session incompatability


dthmtluncrn

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

Archived

This topic is now archived and is closed to further replies.

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