Welcome Guest, Not a member yet? Register   Sign In
Firebird blob insert
#1

hello

i have using codeigniter 3 for a new project with firebird database and i need insert pdf's files in database in blob but i dont know why inserting blob not working

my code is:

PHP Code:
private function blob_create($data) {
        if(
strlen($data) == 0)
            return 
false;
        
$handle ibase_blob_create();
        
$len strlen($data);
        for (
$pos 0$pos $len$pos += 65535) {
            
$buflen = ($pos 65535 $len) ? ($len $pos) : 65535;
            
$buf substr($data,$pos,$buflen);
            
ibase_blob_add($handle,$buf);
        }

        return 
ibase_blob_close($handle);
    }




$ficheiro $this->blob_create(file_get_contents($_FILES['ficheiro']['tmp_name']));
$extensao pathinfo($_FILES['ficheiro']['name'], PATHINFO_EXTENSION);
$nome $_FILES['ficheiro']['name'];
$size intval($_FILES['ficheiro']['size']);

$firebird->query("INSERT INTO DOCUMENTOS (ID_PAI, TIPO_PAI, FICHEIRO, DESCRICAO, TIPO_DOC, OBS, EXTENSAO, NOME_FICHEIRO, TAMANHO, DT_INSERCAO, DT_DOC) VALUES(".$this->db->escape($id).", ".$this->db->escape("MD_AGENDAMENTO").", ".$this->db->escape($blobid).", ".$this->db->escape($descricao).", ".$this->db->escape($tipo).", ".$this->db->escape($obs).", ".$this->db->escape(".".$extensao).", ".$this->db->escape($nome).", ".$this->db->escape($size).", ".$this->db->escape(date("Y-m-d H:i:s")).", ".$this->db->escape($data).")"); 

var_dump($ficheiro); die();
result is 0x0000000100000000
but
ibase_blob_echo($ficheiro);
result is binary file

my problem is insert write 0x0000000100000000 in database and not de blob file..

anyone know how insert blob file in firebird with codeigniter ??

sorry my bad english

best regards
Reply


Messages In This Thread
Firebird blob insert - by turtuga - 07-31-2015, 03:31 AM
RE: Firebird blob insert - by msteudel - 08-03-2015, 11:04 PM
RE: Firebird blob insert - by turtuga - 08-05-2015, 01:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB