Open file in the browser instead of download |
Hi,
i use $this->response->download('path_to_file', null) and want to show this file in the browser. How can i do this? I think the header must be 'Content-Disposition: inline' but setting the header has no effect.
It is difficult.
You can't set a header because that header is set before the data is sent. That is, the title you set is replaced.
Ok, this is crazy, because in the CI 3 Version it works without no further effort. Now I set only the header and used readfile() at the end. This is working, but It's a pity that I can't use the built in function
Can you show the CI3 code?
(08-24-2022, 06:14 PM)kenjis Wrote: Can you show the CI3 code? this is the function i used: https://github.com/bcit-ci/CodeIgniter/b...helper.php The name is force_download. By using this function the document was displyed in the browser: force_download($filename, NULL, true) |
Welcome Guest, Not a member yet? Register Sign In |