[Xerte] toolkits export

David Goodwin david at palepurple.co.uk
Fri Dec 12 09:24:32 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Patrick Lockley wrote:
> When I wrote the code, I had trouble harmonising the headers (i.e making
> them work) on both IE and firefox. In the end I stripped most of the
> headers out because it was the only way I could make it work.
> 
> The header code is part of open source zip class - You can find it in
> website_code/php/scorm/archive.php. Look for the function download_file.
> You'll see that I have commented out the lines. Maybe one of these will
> make yours work. I suspect it is a server settings issue, and would be
> grateful to know which settings work for you.
> 
> Alternatively, you could set the file to be created, then maybe do a
> header redirect? That was my plan B. It might look nicer as you'd could
> also do a progress bar - opinions?

Ah hah.

Well, the attached patch/diff file makes it work for Firefox and IE6
and IE7.

Thanks
David.


- --
 David Goodwin                          Pale Purple Limited
 Office: 0845 0046746                   Mobile: 07792380669
 http://www.palepurple.co.uk            Company No: 5580814
 'Business Web Application Development and Training in PHP'
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJQi3Q/ISo3RF5V6YRAr5cAKCs7yLlDvLbMeePFD5vBQlAsRmbvgCfZNX+
ITyYjcWdAdCpbWTaY8Uu5kc=
=P367
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: website_code/php/scorm/archive.php
===================================================================
--- website_code/php/scorm/archive.php	(revision 12)
+++ website_code/php/scorm/archive.php	(working copy)
@@ -299,7 +299,7 @@
 		switch ($this->options['type'])
 		{
 		case "zip":
-			//header("Content-Type: application/zip");
+			header("Content-Type: application/zip");
 			break;
 		case "bzip":
 			header("Content-Type: application/x-bzip2");
@@ -310,15 +310,10 @@
 		case "tar":
 			header("Content-Type: application/x-tar");
 		}
-		//$header = "Content-Disposition: attachment; filename=\"";
-		//$header .= strstr($this->options['name'], "/") ? substr($this->options['name'], strrpos($this->options['name'], "/") + 1) : $this->options['name'];
-		//$header .= "\"";
-		//header($header);
-		//header("Content-Length: " . strlen($this->archive));
-		//header("Content-Transfer-Encoding: binary");
-		header('Content-disposition: attachment; filename=' . $name . '.zip');
-		header('Content-type: application/zip');
-		//header("Cache-Control: no-cache, must-revalidate, max-age=60");
+		header("Content-Length: " . strlen($this->archive));
+        header("Pragma: public");
+		header('Content-disposition: attachment; filename="' . $name . '.zip"');
+		header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
 		header("Expires: Sat, 01 Jan 2000 12:00:00 GMT");
 		header("Content-Transfer-Encoding: binary");
 		print($this->archive);
@@ -671,4 +666,4 @@
 
 		return 1;
 	}
-} ?>
\ No newline at end of file
+} ?>


More information about the Xerte mailing list