Response object *is* available in Helper, just use

$this->response->type('csv');
$this->response->download($this->filename);
$this->response->send();

Am Mittwoch, 11. Juni 2014 00:49:58 UTC+2 schrieb gloop:
>>
>> Hello i try to write an helper to create and download a CSV.
>>
>> Now i have the problem to set the type in the helper.
>>
>> I try:
>>
>> function renderHeaders() {
>>     $response = new CakeResponse(array(
>>        'type' => 'csv'
>>     ));
>>     $response->download($this->filename);
>>     $response->send();
>> }
>>
>> Now i can download the file, but it's always type "text/html".
>>
>> When i set in the controller $this->response->type('csv'); it works 
>> correct.
>>
>> Is there a way to use the CakeResponse in the Helper?
>>
>> Kind Regards
>> Steffen
>>  
>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to