The download response isn't working as expected, when the download is initiated, the page goes blank.
the response is expected to return the send method, but does not.
here is how i used the response
$fname = $storepath.$order->order_reference . "_ticket.pdf";
Services::response()->download($fname, NULL);
so i altered the download method to return return $response->send(); instead of return $response;
i initially thought the send would be returned from the codeigniter class.
Why don't use this :
Services::response()->download($fname, NULL)->send();
It's logical for me to use special method to send the result. Since you can use several methods on the DownloadResponse.
Have you returned the DownloadResponse class?
Please implement as follows.
<?php namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\Config\Services;
class Sample extends Controller
{
聽聽聽 public function donwload()
聽聽聽 {
聽聽聽聽聽聽聽 $fname = __FILE__;
聽聽聽聽聽聽聽 return Services::response()->download($fname, NULL);
聽聽聽 }
}
@ytetsuro you make a point. But then a simple download helper would be nice. And an update to the doc
Yes, the response must be returned. This gives it a chance to run through any filters before being sent.
I'll double check the docs on that and make sure they reflect the current process since the recent change.