소스 검색

Add "setDownloadHeaders" helper function

Alan Lam 8 년 전
부모
커밋
96455cb4b8
1개의 변경된 파일과 6개의 추가작업 그리고 0개의 파일을 삭제
  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;