Ciao cosi dovrebbe andare
codice:
<?php
session_start();
if(isset($_SESSION['ID_cliente'])){
require_once("../amministra/config.php");
$documento=mysql_fetch_array(mysql_query("SELECT * FROM immagini WHERE ID = '$_GET[id]'"));
if($_GET['lang']=='it'){$file_download=$documento['file'];}
mysql_close($link);
$mime_types = array(
"bmp" => "image/bmp",
"exe" => "application/octet-stream",
"html" => "text/html",
"ico" => "image/x-icon",
"jpeg" => "image/jpeg",
"png" => "image/png",
"jpg" => "image/jpeg",
"mov" => "video/quicktime",
"mp3" => "audio/mpeg",
"mp4" => "video/mpeg",
"mpeg" => "video/mpeg",
"mpg" => "video/mpeg",
"txt" => "text/plain",
"wav" => "audio/x-wav",
"zip" => "application/zip"
);
$file='../images/documenti/'.$file_download;
$info = pathinfo($file);
$ext = strtolower($info["extension"]);
$mt = isset($mime_types[$ext]) ? $mime_types[$ext] : "application/octet-stream";
//exit();
//header("Content-type:*");
header("Cache-Control: public");
header("Content-Type: {$mt}");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=".$file);
header("Content-Transfer-Encoding: binary");
readfile($file);
exit();
}
?>
Saluti
Davide