IE és a download
kérdés adott akarmi fájlt kiszolgálok egy ilyen kódal magyarán felhozza az open/download ablakot, adott fájlra, namost fx alatt nincs is gáz, de IE alatt a kiküldött session_start ill. no-cache header miatt nem fér hozzá az open gomb megnyomásával leszedett cuccoshoz ( a gyorstárból kéne, de ott nem jön létre az előbbiek miatt), ergo nem tudja megnyitni
kiadva a ini_set("session.cache_limiter","private"); -t persze igen, de ekkor admin oldal ill. egyébb generált tartalom nem frissül
kis helpet, pls thx :)
■ - <?php
- function get_content_type($extension)
- {
- switch (strtolower($extension))
- {
- case 'txt': return 'text/plain';
- case 'com': return 'application/x-msdownload';
- case 'pdf': return 'application/pdf';
- case 'html': return 'text/html';
- case 'gif': return 'image/gif';
- case 'jpg': return 'image/jpeg';
- case 'png': return 'image/png';
- case 'zip': return 'application/x-zip-compressed';
- case 'rar': return 'application/x-rar-compressed';
- case 'gz': return 'application/x-gzip';
- case 'tar': return 'application/x-tar';
- }
- return 'unknown';
- }
- if (isset($_GET['download']))
- {
- $file = pathinfo($_GET['download']);
- header('Content-Type: ' . get_content_type($file['extension']));
- header('Content-Disposition: Attachment; filename="' .$file['basename']. '"');
- readfile($root_path.'usr/templates/'.$_GET['download']);
- exit();
- }
- ?>
kiadva a ini_set("session.cache_limiter","private"); -t persze igen, de ekkor admin oldal ill. egyébb generált tartalom nem frissül
kis helpet, pls thx :)