Originariamente inviato da php_34
allora fai qualcosa del genere:
if(!function_exists('mime_content_type')) {
function mime_content_type($f) {
$f = escapeshellarg($f);
return trim( `file -bi $f` );
}
}
function download($file) {
if((file_exists($file)) && (is_readable($file))) {
$filecontents = implode("", file($file));
$type = mime_content_type($file);
$size = filesize($file);
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=\"".basename($file)."\");
header("Content-Length: $size");
header("Content-Transfer-Encoding: binary");
echo $filecontents;
exit(0);
}
}
if(funzioneutenteloggatocherestituisceTRUEsel'uten teèloggato) {
download($file);
}else{
echo "che caxx stai facendo??? LOGGATI BAS*****

";
}
spero sia chiaro