-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download Response Not working #1331
Comments
Why don't use this :
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? <?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. |
Update docs for downloads to reflect the need to return it. Fixes #1331
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.
The text was updated successfully, but these errors were encountered: