fanfavorite Posted September 5, 2008 Share Posted September 5, 2008 I have a script that downloads mp3 files from outside the web directory. It works great on all browsers except Internet Explorer. I have simplified the script to better show what is happening. Basically if I remove the "session_start", the script downloads fine on Internet Explorer, however if it is there, it will not work. The code is: <? session_start(); $file_name = "SomeFile.mp3"; $file_path = "/path/to/files/"; header("Content-Type: application/unknown"); header("Content-Disposition: filename=$file_name"); if($fp = fopen($file_path.$file_name, "r")) { while(!feof($fp)) { echo fgets($fp, 4096); } fclose($fp); } ?> I have read about "zlib.output_compression", however this is already set to off. Any help is appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/122944-solved-session_start-causings-problems-with-ie/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 5, 2008 Share Posted September 5, 2008 Are you sure the session_start() is not triggering a php error and the error message being output to the browser is content that is preventing the other headers from working? Just as a test, add the following line immediately after your <?php tag - ini_set ("display_errors", "0"); Link to comment https://forums.phpfreaks.com/topic/122944-solved-session_start-causings-problems-with-ie/#findComment-634974 Share on other sites More sharing options...
fanfavorite Posted September 5, 2008 Author Share Posted September 5, 2008 Yes I am positive. Give that script a try. I have read about issues with this, but no fixes I have seen are working. Link to comment https://forums.phpfreaks.com/topic/122944-solved-session_start-causings-problems-with-ie/#findComment-634978 Share on other sites More sharing options...
fanfavorite Posted September 6, 2008 Author Share Posted September 6, 2008 I actually just came across this article http://joseph.randomnetworks.com/archives/2004/10/01/making-ie-accept-file-downloads/. Adding: if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { session_cache_limiter("public"); } above the session_start(); seems to work. Link to comment https://forums.phpfreaks.com/topic/122944-solved-session_start-causings-problems-with-ie/#findComment-634981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.