Fai così
Codice PHP:
<?php
$nomeFile = "ciccio.txt";
// lunghezza in byte
$len = "1024";
// contenuto del file, lo puoi leggere usando la funzione fread()
$what = "asdbasbdiasb";
$user_agent=${"HTTP_USER_AGENT"};
if (strpos($user_agent,"Gecko")) $nomeFile = str_replace("ö","o",str_replace("ä","a",strtolower($nomeFile)));
header("Pragma: public");
header("Cache-control: private"); // fix for IE
header("Expires: 0");
header("Content-type: application/RFC822");
header("Content-type: octet/stream\n");
header("Content-transfer-encoding: binary\n");
header("Content-Disposition: attachment; filename=".stripslashes($nomeFile)."\n");
header("Content-Length: ".$len);
echo $what;
exit();
?>