Subject Re: [firebird-php] Re: File upload
Author Sakhile Njoko
I have just one challenge now. The file import only works if the file is the same folder as the PHP script. How can I make it work regardless of file location?
 
Sakhi

--- On Sat, 13/8/11, Sakhile Njoko <sakhinjoko@...> wrote:


From: Sakhile Njoko <sakhinjoko@...>
Subject: Re: [firebird-php] Re: File upload
To: firebird-php@yahoogroups.com
Date: Saturday, 13 August, 2011, 21:28


 



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]








[Non-text portions of this message have been removed]