Comincio ad avere il vaghissimo sospetto che tu stia facendo copia ed incolla un po' a caso.


codice:
<?php

$pdf=$_POST['pdf'];

function getFile($fileName) {
 if($file = fopen("../documenti/".$fileName, "rb")) {
  $data = '';
  while (!feof($file)) {
   $data .= fread($file, 8192);

  }
 
  fclose($file);
  return $data;
  } else {
   return FALSE;
  }
}

if(!header_sent()) {
 header('Content-type: application/msword');
 header('Content-Disposition: attachment; filename='. $filename);

 echo getFile($pdf);
}
?>