Jump to content

readfile in IE clearing session


dc_jt

Recommended Posts

Ive got the following code which works fine in firefox, however in IE the file opens fine but for some reason it clears my session so once a user has downloaded the file, it logs them out the system.

 

Does anyone know whats causing IE to clear the session?

 

header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($oDoc->document_name));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: private');
    header('Pragma: private');
    header('Content-Length: ' . filesize($sUrl));
    
    ob_clean();
    flush();
    readfile($sUrl);
    exit;

Link to comment
Share on other sites

If I had to take a random guess, it would be the Expires line. I would remove that header and see if it makes a difference.

 

Thanks for the guess, I have tried that already but had no luck! Really dont know why it is doing it in IE. Does anyone have a script which they know definitely keeps the session data in IE??

Link to comment
Share on other sites

What version of IE are you testing this on?

 

Just another random guess, have you tried removing the Cache portion as well?

 

I have just tried it on a few other machines and it looks as though it is a problem with my IE!

 

Thanks for the help anyway.

Link to comment
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.