ryxeo-glpi-git / plugins / anet_epacks / front / tools.php @ 97e94661
Historique | Voir | Annoter | Télécharger (875 octets)
1 | b67d8923 | Eric Seigne | <?php
|
---|---|---|---|
2 | function pushfile($fichier) { |
||
3 | if(file_exists($fichier)) { |
||
4 | header('Content-Description: File Transfer'); |
||
5 | |||
6 | //En fonction de l'extention on passe ce qu'il faut au brouteur
|
||
7 | $ext = strtolower(substr($fichier, strrpos($fichier, '.'))); |
||
8 | if($ext == ".odt") |
||
9 | header('Content-Type: application/vnd.oasis.opendocument.text'); |
||
10 | else if($ext == ".pdf") |
||
11 | header('Content-Type: application/pdf'); |
||
12 | else
|
||
13 | header('Content-Type: application/octet-stream'); |
||
14 | header('Content-Disposition: attachment; filename='.basename($fichier)); |
||
15 | header('Content-Transfer-Encoding: binary'); |
||
16 | header('Expires: 0'); |
||
17 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
||
18 | header('Pragma: public'); |
||
19 | header('Content-Length: ' . filesize($fichier)); |
||
20 | @ob_clean();
|
||
21 | @flush(); |
||
22 | @readfile($fichier); |
||
23 | exit;
|
||
24 | } |
||
25 | } |
||
26 | |||
27 | ?> |