Explorar el Código

Add "setDownloadHeaders" helper function

Alan Lam hace 8 años
padre
commit
96455cb4b8
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      engine/http.php

+ 6 - 0
engine/http.php

@@ -32,6 +32,12 @@ class HTTP {
 		return $result;
 	}
 
+	public static function setDownloadHeaders($filename) {
+		header("Content-Disposition: attachment; filename=\"$filename\"");
+		header("Cache-Control: private, max-age=0, must-revalidate");
+		header("Pragma: public");
+	}
+
 	public static function getDateFromFields($prefix = "") {
 		$date = false;