This repository was archived by the owner on Sep 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,11 @@ public function __construct ($filePointer)
48
48
* Sends the download to the browser
49
49
*
50
50
* @param string $filename
51
+ * @param bool $forceDownload
51
52
*
52
53
* @throws \RuntimeException is thrown, if the headers are already sent
53
54
*/
54
- public function sendDownload ($ filename )
55
+ public function sendDownload ($ filename, $ forceDownload = true )
55
56
{
56
57
if (headers_sent ())
57
58
{
@@ -63,7 +64,16 @@ public function sendDownload ($filename)
63
64
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0 " );
64
65
header ("Cache-Control: private " , false );
65
66
header ("Content-Type: {$ this ->getMimeType ($ filename )}" );
66
- header ("Content-Disposition: attachment; filename= \"{$ filename }\"; " );
67
+
68
+ if ($ forceDownload )
69
+ {
70
+ header ("Content-Disposition: attachment; filename= \"{$ filename }\"; " );
71
+ }
72
+ else
73
+ {
74
+ header ("Content-Disposition: filename= \"{$ filename }\"; " );
75
+ }
76
+
67
77
header ("Content-Transfer-Encoding: binary " );
68
78
header ("Content-Length: {$ this ->getFileSize ()}" );
69
79
You can’t perform that action at this time.
0 commit comments