public function download($attachmentId = null)
    {
        $attachment = $this->Attachments->get($attachmentId);

        $this->_checkAuthorization($attachment);

        $this->response->file($attachment->getAbsolutePath(), [
            'download' => true,
            'name' => $attachment->filename
        ]);
        return $this->response;
    }
public function download($attachmentId = null)
    {
        $attachment = $this->Attachments->get($attachmentId);

        $this->_checkAuthorization($attachment);

        $this->response->file($attachment->getAbsolutePath(), [
            'download' => true,
            'name' => $attachment->filename
        ]);
        return $this->response;
    }
public function download ( $ attachmentId = null ) { $ attachment = $ this -> Attachments -> get ( $ attachmentId ) ; $ this -> _checkAuthorization ( $ attachment ) ; $ this -> response -> file ( $ attachment -> getAbsolutePath ( ) , [ 'download' => true , 'name' => $ attachment -> filename ] ) ; return $ this -> response ; }
Download the file

@param string $attachmentId Attachment ID
@return void
Download the file