Subject | Re: [firebird-php] Re: File upload |
---|---|
Author | Sakhile Njoko |
Post date | 2011-08-13T18:28:36Z |
Thanks Christophe. It is working like a charm.
--- On Fri, 12/8/11, .Christophe DERENNE <ch.derenne@...> wrote:
From: .Christophe DERENNE <ch.derenne@...>
Subject: [firebird-php] Re: File upload
To: firebird-php@yahoogroups.com
Date: Friday, 12 August, 2011, 0:02
Hi, of course you can !
For example :
function UpdateBlobFile($pkid,$filename)
{
$msg="";
$fd=fopen($filename,"r");
if ($fd)
{
@$blob =ibase_blob_import($this->db, $fd);
fclose($fd);
if (!$blob)
$msg="Cannot import";
else
{
$query = "UPDATE MYTABLE SET REPORT = ? WHERE MYPKID = ".$pkid;
$prepared=ibase_prepare($this->db,$query);
if ($prepared)
{
if (!ibase_execute($prepared,$blob))
$msg=ibase_errmsg();
}
else $msg=ibase_errmsg();
}
}
else $msg="Cannot read ".$filename;
return $msg;
}
Rgds
Christophe Derenne
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]