Welcome Guest, Not a member yet? Register   Sign In
Having issues setting Content-Type header. Still coming out as text/html
#1

[eluser]jaydisc[/eluser]
Hi all,

I've got a couple of methods that validate a user's access to a PDF or image, and then serve it out if access is granted.

Once I've validated their permission, I make sure the file exists and attempt to hand it out:

Code:
$this->load->helper('file');
if ($image = read_file('../content/path-to-image.jpeg'))
{
    $this->output->set_header('Content-Type: image/jpeg');
    echo $image;
}
else
{
    show_404();
    return FALSE;
}

Unfortunately, the mime type is still going out as text/html. I've tried using php's header() instead of CI's set_header() and php's readfile instead of CI's read_file, but it all seems the same.

I suspect this is a common issue due to an apache configuration parameter. Can anyone point me in the right direction?

Thanks.


Messages In This Thread
Having issues setting Content-Type header. Still coming out as text/html - by El Forum - 10-08-2010, 12:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB