1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"><?php
$</span></span><font color="#009900"><strong>file_name</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"> </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">"file.name"</span><span style="color: rgb(0, 119, 0);">;
</span><span style="color: rgb(0, 0, 187);">$</span></span><font color="#009900"><strong>file_path</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"> </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(221, 0, 0);">"/path/to/realfile"</span><span style="color: rgb(0, 119, 0);">;
</span><span style="color: rgb(0, 0, 187);">$</span></span><font color="#009900"><strong>file_size</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"> </span><span style="color: rgb(0, 119, 0);">= </span><span style="color: rgb(0, 0, 187);">filesize</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$</span></span><font color="#009900"><strong>file_path</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Pragma: public'</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Expires: 0'</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Last-Modified: ' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">gmdate</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'D, d M Y H:i '</span><span style="color: rgb(0, 119, 0);">) . </span><span style="color: rgb(221, 0, 0);">' GMT'</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Cache-Control: must-revalidate, post-check=0, pre-check=0'</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Cache-Control: private'</span><span style="color: rgb(0, 119, 0);">, </span><span style="color: rgb(0, 0, 187);">false</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Content-Type: <strong>application/octet-stream</strong>'</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Content-Length: ' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$</span></span><font color="#009900"><strong>file_size</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Content-Disposition: attachment; filename="' </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(0, 0, 187);">$</span></span><font color="#009900"><strong>file_name</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"> </span><span style="color: rgb(0, 119, 0);">. </span><span style="color: rgb(221, 0, 0);">'";'</span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">header</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'Content-Transfer-Encoding: <strong>binary'</strong></span><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">readfile</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$</span></span><font color="#009900"><strong>file_path</strong></font><span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 119, 0);">);
</span><span style="color: rgb(0, 0, 187);">?></span></span>
|