I just started to use meioupload to upload my files from cakephp, however, i'm not sure how do i code the download.
I tried using the following code:
echo $file['Image']['dir'].$file['Image']['filename'];
however, it seems that the code is wrong. as it output the following:
uploads\image\filenamedb_fyp_2.txt
How do i download the file db_fyp2.txt?
Thanks for the answer, but i already found out how to download the files using mediaview of cakephp.
Anyway, to answer my own question, to download the file with various extension, the following code can be used.
Using Media View of cakephp - in the controller
public function download($id){
$this->viewClass = 'Media';
$this->autoLayout = false;
$file = $this->Image->findById($id);
$link = $file['Image']['dir'];
$params = array(
'id' => $file['Image']['filename'],
'name' => $file['Image']['filename'],
'download' => true,
'mimeType' => $file['Image']['mimetype'],
'extension' => array('pdf','zip','txt'),
'path' => $link.DS
);
$this->set($params);