When I am saving a file in a img/upload folder the file is saved with the correct file-extension.
However, when I try to download the file, a .htm file-extension is appended.
How can I avoid this? I've added my code below;
view.ctp
<?php echo $this->Form->label("Resume:");?>
<?php echo $this->Form->input("resume",array("class"=>"input_boxstyle_select","label"=>"","type"=>"file","id"=>"file"));?>
<a href="../download_resume/<?php echo $editEmpPros[0]['prospective_employee']['resume']?>" style="margin-left:140px;color:#0477CA;"> <?php echo $editEmpPros[0]['prospective_employee']['resume']?> </a>
Inside my controller:
public function download_resume($id=null)
{
$LUser = $this->Session->read('username');
$this->disableCache();
if (!$LUser) {
$this->redirect(array("action"=>"../"));
}
$path="../webroot/img/upload/$id";
header('Content-Disposition: attachment'); readfile($path);
//print_r(readfile($path));
exit;
}