Hello,
i almost solved my problem, but there is still a little fault. In one
of my views i readout a database cell, with a text inside, e.g. 13.pdf
(13.pdf = document_name).

The little fault is, when i click on the text in the column (e.g.
13.pdf) a download-windows opens and the file i download is called
"13.pdf.pdf". :(
So what is wrong there?


Source-code in my view to invoke the download-method in the
controller:
{{{
<td><?php echo $html->link($document['Document']['document_name'],
array('action'=>'download', $document['Document']['id'])); ?></td>
}}}

Source of my download-function in my documents_controller:
{{{
function download($id = null)
  {
    $this->view = 'Media';
        $this->autoLayout = false;

                $this->Document->recursive = -1;
                $document = $this->Document->read(null, $id);

    if (empty($document))
    {
                  $this->redirect('/', 404, true);
        }

    $file = $document['Document']['document_name'];
    $basename = basename($file);
    $file_extension = strtolower(substr(strrchr($basename,"."),1));

    $this->set('id', $document['Document']['document_name']);
    $this->set('name', $basename);
        $this->set('download', true);
    $this->set('extension', $file_extension);
        $this->set('path',APP.'files'.DS);
        }
}}}
The files are stored in cake -> app -> files.

Thanks if someone can help!!!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to