I was hitting my head on the wall for a big amount of time finding why
i was no more able to download file from glpi (version 0.68, indeed).

Afer fiddling with header() function php manual, i've patched
common.function.php as attached, finding that it_IT.php have an extra
character appended in it. ;(


Please, use headers_sent() function as an error booster! ;)

-- 
dott. Marco Gaiarin                                 GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  marco.gaiarin(at)sv.lnf.it      tel +39-0434-842711  fax +39-0434-842797
--- common.function.php.orig	2008-02-12 18:36:29.000000000 +0100
+++ common.function.php	2008-02-12 18:44:25.000000000 +0100
@@ -287,17 +287,22 @@
 			}
 
 		}
+		
+		if (headers_sent($f, $l)) {
+			// ... where were the mysterious headers sent from?
+			echo "Headers were already sent in $f on line $l...";
+		}
 
 		// Now send the file with header() magic
 		header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
 		header('Pragma: private'); /// IE BUG + SSL
 		//header('Pragma: no-cache'); 
 		header('Cache-control: private, must-revalidate'); /// IE BUG + SSL
-		header("Content-disposition: filename=\"$filename\"");
+		header("Content-disposition: attachment; filename=\"$filename\"");
 		header("Content-type: ".$mime);
-
-
-
+		$len = filesize($file);
+		header("Content-Transfer-Encoding: binary");
+		header("Content-Length: ".$len);
 
 
 		$f=fopen($file,"r");
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to