I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's ORM library.
The code looks something like:
$attachment = new Attachment_Model();
$attachment->name = $info['FileName'];
$attachment->size = strlen($info['Data']);
$attachment->data = $info['Data'];
$attachment->mime_type = $info['content-type'];
$attachment->save();
I've verified that the data is OK at this point by outputting it to a file. However, when I retrieve the data it comes out corrupted. I've managed to narrow this down a bit more - I've used the MySQL query tool to extract the data as held in the database and I can verify that the data in the database is corrupt, so the problem must be on the INSERT.
Also, the files inputted aren't always corrupt - smaller files (such as images) tend to be OK.
Anyone have any ideas?