Hello, i want to ask.. how to use header for download file in modx??
I use modx evolution 1.0.0 and make snippet for download file from ’assets/docs/’

but i have problem.. results files after the download not the same as the original file or damage...
this my pieces snippet code..
if($status == 'download'){
$id =$_GET['idfile'];
$query = $modx->db->query("SELECT * FROM uploadf WHERE id = '$id'");
$data = mysql_fetch_array($query);
$namefile= str_replace(" ","_",$data['name']);
header("Content-Disposition: attachment; filename=".$namefile);
header("Content-length: ".$data['size']);
header("Content-type: ".$data['type']);
$fp = fopen("assets/docs/".$data['name'], 'r');
$content = fread($fp, filesize('assets/docs/'.$data['name']));
fclose($fp);
return $content;
}
is there a solution to this problem or another way to download files...
regards,
syu11