SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | $one_year = 31536000; //seconds | |
4 | ||
5 | $file_path = ''; // relative or absolute path on your server. | |
6 | $file_name = basename($file_path); | |
7 | ||
8 | $file_modify_time = @filemtime($file_path); | |
9 | ||
10 | $gmt_modify_time = gmdate('D, d M Y H:i:s', $file_modify_time ) . ' GMT'; | |
11 | $gmt_expire_time = gmdate('D, d M Y H:i:s', time() + $one_year ) . ' GMT'; | |
12 | ||
13 | $file_size = @filesize($file_path); | |
14 | ||
15 | header('Pragma: '); | |
16 | header('Cache-Control: public'); | |
17 | header('Last-Modified: ' . $gmt_modify_time ); | |
18 | header('Expires: ' . $gmt_expire_time ); | |
19 | header('Content-Length: ' . $file_size); | |
20 | header('Content-Disposition: filename="' . $file_name . '";'); | |
21 | header('Content-Type: image/gif'); | |
22 | header('Content-Transfer-Encoding: binary'); | |
23 | ||
24 | $file_handle = fopen($file_path, "r"); | |
25 | ||
26 | while (!feof($file_handle)) { | |
27 | $data = fgetss($file_handle, 50); | |
28 | ||
29 | if($data === FALSE) { | |
30 | error_log('Error reading file: '.$file_path); | |
31 | exit(); | |
32 | } | |
33 | ||
34 | print_r($data); | |
35 | ||
36 | sleep(1); | |
37 | } | |
38 | ||
39 | fclose($file_handle); |