I have a web-based system built with user login data based on session variables.
Sometimes when a user is logged in and tries to export tables to csv or xls the session data seems to wipe and the user is 'kicked out' of the system.
This is the header code I'm using to serve the file.
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=file.xls");
header("Content-Transfer-Encoding: binary ");
If it helps it seems to be more prevalent on ie6. I was wondering if anyone has had similar issues.
This is the latest header I've tried. Still no luck. Also tested the exact same procedure in FF/Opera/Safari and they're fine.
header('Cache-Control: no-store, private, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0, max-stale = 0', false); // HTTP/1.1
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Expires: 0', false);
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Pragma: no-cache');
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment;filename=$fileName");
header("Content-Transfer-Encoding: binary ");