Welcome Guest, Not a member yet? Register   Sign In
Random problem with set_header()
#1

I am having a random issue with Content-Disposition header not being sent from my controller, depending on the content.  Here is my controller function:


PHP Code:
public function download() {
        $this->output->set_content_type('text/csv');
        $this->output->set_header('Content-Disposition: attachment; filename="test.csv"');
        //header('Content-Disposition: attachment; filename="test.csv"');
        readfile('/tmp/test.csv');




If I un-comment the header() call, then it always works, but otherwise sometimes it works and sometimes not, seems to depend either on the content of /tmp/test.csv or else it is just plain random -- I have not been able to nail down any specific lines of content that consistently reproduce the issue.

It seems pretty simple but maybe I'm doing something wrong?

(This is CI 3.1.10, using PHP 7.3.11, with Apache 2.4 and modsecurity2)
Reply


Messages In This Thread
Random problem with set_header() - by mdr1384 - 01-31-2020, 05:53 AM
RE: Random problem with set_header() - by mdr1384 - 01-31-2020, 02:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB