Autor Zpráva
http
Profil
kod je z www.php.net
na .jpg soubory funguje perfektne, ale .doc soubory nebere, přesněji řečeno, jsou pak nějaký překodovaný a nejdou otevřít...

<?php

if ($doc)
{
$filename = "zpravy/";
}

$filename = $filename.$doc;
$filename = realpath($filename);

$file_extension = strtolower(substr(strrchr($filename,"."),1));

switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}

//echo $ctype;
//exit;


if (!file_exists($filename)) {
die("NO FILE HERE");
}

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
@readfile("$filename") or die("File not found.");
?>


mám to na stránce: www.tipsport.cz/press/
když si kliknete na Stahuj DOC u těch prvních třech zprávách, tak to používá tenhle script.

Jakoukoliv radu fakt uvítám...
Díky Pavel
zkus tohle
Profil *
case "doc": $ctype="application/vnd.ms-word"; break;
http
Profil
bohužel stale nefunguje :(
http
Profil
už to mám, nevím sice na co to bylo, ale vadilo mu tam to: set_time_limit(0);
a použil jsem tvou radu: case "doc": $ctype="application/vnd.ms-word"; break;


Pavel
Toto téma je uzamčeno. Odpověď nelze zaslat.

0