Welcome Guest, Not a member yet? Register   Sign In
Open file in the browser instead of download
#1

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.
Reply
#2

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.
Reply
#3

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
Reply
#4

Can you show the CI3 code?
Reply
#5

(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)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB