[eluser]vickel[/eluser]
I'm sucessfully uploading a file (zip, pdf, jpg, etc) into a blob field, but when trying to read it, I just cannot make it work within CI -> it works fine calling the exactly same php script (reading) outside CI.
Please don't tell me it's not a good ideia to store files in blob. I know the issues but have to come up with a solution for described above.
I'm using for writing:
Code:
$data = mysql_real_escape_string($data);
$this->db->set('data', "'" . $data . "'", FALSE);
$this->db->set('ext',$ext);
$this->db->insert($table);
and for reading:
Code:
$id=1;
$result = mysql_query("SELECT ext, data
FROM {$table}
WHERE id=$id LIMIT 1");
list($ext,$data) = mysql_fetch_row($result);
// outputing HTTP headers
header('Content-Length: '.strlen($data));
header("Content-type: image/{$ext}");
header("Content-Disposition: attachment; filename=testfile.$ext");
// outputing image
echo $data;
Thank you in advance for any help on that