new_php85 Posted May 9, 2011 Share Posted May 9, 2011 Hi Guys.... I need to export data into excel file. So far its works on IE and Firefox. But if i using Google Chrome it download only php file. Eg(suppose file test.xls but it goes to test.php). Why it happen?? Link to comment https://forums.phpfreaks.com/topic/235893-export-data-to-excel-file-works-on-iefirefox-but-not-google-chrome/ Share on other sites More sharing options...
trq Posted May 9, 2011 Share Posted May 9, 2011 Why it happen?? How should we know? Link to comment https://forums.phpfreaks.com/topic/235893-export-data-to-excel-file-works-on-iefirefox-but-not-google-chrome/#findComment-1212737 Share on other sites More sharing options...
new_php85 Posted May 10, 2011 Author Share Posted May 10, 2011 Basically, i using this code to generate excel file if($_REQUEST["rFormat"]=="2") { header("Content-Type: application/x-msexcel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); } and it works at IE and FF. Only google chrome not work. Link to comment https://forums.phpfreaks.com/topic/235893-export-data-to-excel-file-works-on-iefirefox-but-not-google-chrome/#findComment-1213143 Share on other sites More sharing options...
new_php85 Posted May 10, 2011 Author Share Posted May 10, 2011 Basically, i using this code to generate excel file if($_REQUEST["rFormat"]=="2") { header("Content-Type: application/x-msexcel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); } and it works at IE and FF. Only google chrome not work. i got the problem it suppose like this if($_REQUEST["rFormat"]=="2") { header("Content-Type: application/x-msexcel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Disposition: attachment; filename=email_sms_export.xls");// i missed out this link } now its works on IE/FF/Google Chrome Link to comment https://forums.phpfreaks.com/topic/235893-export-data-to-excel-file-works-on-iefirefox-but-not-google-chrome/#findComment-1213231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.