Welcome Guest, Not a member yet? Register   Sign In
set_header() file download problem
#1
Exclamation 
(This post was last modified: 12-29-2015, 02:43 AM by Rashid.)

CI 3.0.3. Here is my question on stackoverflow: http://stackoverflow.com/questions/34432...-size-n-kb

Further investigation revealed the fact that CI's set_header() method doesn't send 'Content-Disposition' header:

[Image: YEnEXOv.png]

In other words, $this->output->set_header() does not work, while php's native header() with the same param - works.

CAUSES PROBLEM:
PHP Code:
$this->output->set_header('Content-Description: File Transfer');
$this->output->set_header('Content-Type: application/octet-stream');
$this->output->set_header('Content-Disposition: attachment; filename="Segmentation ' $date->format('Y-m-d H:i:s') . '.' $format '"');
$this->output->set_header('Expires: 0');
$this->output->set_header('Cache-Control: must-revalidate');
$this->output->set_header('Pragma: public');
$this->output->set_header('Content-Length: ' strlen($str));
echo 
$str;
exit(); 

CORRECT:
PHP Code:
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="Segmentation ' $date->format('Y-m-d H:i:s') . '.' $format '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' strlen($str));
echo 
$str;
exit(); 

Is it bug?
Reply


Messages In This Thread
set_header() file download problem - by Rashid - 12-29-2015, 02:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB