Witam! Napisałem taki oto kodzik
$fullPath = '../slajdy/'.$_POST['hid'];
//$fullPath = '../slajdy/00055e6998210f4718899a4300c80f30.jpg';
if ($fd = fopen ($fullPath, "r")) { switch ($ext) {
case "jpg":
header("Content-type: image/jpg"); header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); break;
case 'png':
header("Content-Type: image/png"); break;
case 'gif':
header("Content-Type: image/gif"); break;
case 'swf':
header("Content-Type: application/x-shockwave-flash"); break;
case 'flv':
header('Content-Type: video/x-flv'); break;
default;
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); }
header("Content-length: $fsize"); header("Cache-control: private"); $buffer = fread($fd, 2048
); }
}
Jak widzicie, ma on za zadanie ściągać pliki na dysk po kliknięciu jakiegoś tam przycisku. Wszystko jest ok z plikami typu jpg, gif , natomiast przy próbie ściągniecia flv lub swf zamiast ściągać film, to ściąga skrypt php w którym umieszczony jest w/w kod .
Dlaczego ?