[eluser]jadine[/eluser]
Hi,
I would really appreciate if someone can give a few pointers here. I have in my controller a download function which looks like this:
Code:
public function download($file_name){
$mime = 'application/vnd.google-earth.kmz';
$path = $_SERVER['DOCUMENT_ROOT']."/trackdb/modules/gis/assets/archive/";
$full_name = $path.$file_name;
echo($full_name);
header('Content-Type: '.$mime);
header("Content-Disposition: attachment; filename=$file_name");
header("Pragma: no-cache");
header("Expires: 0");
readfile("$full_name");
exit();
}
In my view, I have:
Code:
echo anchor('gis/download/'.$result, 'Download KMZ file', 'title="KMZ File"');
$result is the file name passed from the controller.
The generated URL of the link looks like:
http://{Domain}/trackdb/index.php/gis/download/Sites.kmz
Which is the correct file name. The problem is that the file doesn't actually download. It simply downloads a dummy 1 KB .kmz file (the real file in that location is over 2MB).
Many thanks
Jad