0 Replies - 3007 Views - Last Post: 17 March 2008 - 10:56 PM Rate Topic: -----

#1 godbout  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-March 08

Force download doesn't work with IE7 on remote server

Posted 17 March 2008 - 10:56 PM

Hi there,

I've got a problem and I've already spent too much time on it for the small thing it is.

I've got 2 php pages. One is the main one, calling the second one. The second is just a page to force the download of a file.
When I use them locally, I don't have any problem. It works well with IE and FF. The 'Save dialog box" appears in both cases, and I case save or open my file perfectly.

But when I put the file on my remote server, it works well with FF but doesn't work anymore with IE7. IE7 opens the second page but close it automatically and immediately. The "Save dialog box" never appears, and I cannot find the reason.

After 2 days of trying to understand what's happening, I gave up (quite often with IE).
I chose another solution, not the one I wanted, but I cannot loose too much time with that.

Anyway, I would still understand what's happening, if anybody gets an idea.

Here is the code used:

In the main page, to call the second php file
echo '<script language="Javascript">window.open(\'dl.php?filename=' .basename( $appFile ) .'\',\'download\')</script>';



The second page
<?php
	$filename = '../appFiles/'. $_GET['filename'];

	if ( substr(strrchr($filename, '.'), 1) == 'xls' )
	{

		if(ini_get('zlib.output_compression'))
		ini_set('zlib.output_compression', 'Off');

		header("Pragma: public");
		header("Expires: 0");
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
		header("Cache-Control: private",false);
		header("Content-Type: application/octet-stream");
		header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
		header("Content-Length: ".@filesize($filename));
		set_time_limit(0);
		readfile("$filename") or die("File not found.");
	}
?>



Thanks for your help!

This post has been edited by godbout: 17 March 2008 - 11:01 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1