adodb to upload file to database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

adodb to upload file to database

Post by yacahuma »

I need to upload files to oracle. I got the code working perfectly using the oci calls. But since I am using adodb for everything else, I wanted to use adodb for the upload. The problem is I get the following error.

(oci8): insert into archivo2 (id, filename,filesize) values(2, 'puerta2.JPG',1352390) /home/webuser/webapache/uploads/phpX2aiFu (oci8): UPDATE archivo2 set the_blob=EMPTY_BLOB() WHERE id=2 RETURNING the_blob INTO :blob [ (blob=>'Array') ] name=:blob

Catchable fatal error: Object of class OCI-Lob could not be converted to string in /home/webuser/webapache/htdocs/common/adodb/drivers/adodb-oci8.inc.php on line 984
---------------

Code: Select all

 
 
$sql = "insert into archivo2 (id, filename,filesize) values({$id}, '{$filename}',$size)";
$db->StartTrans();
if (! $db->Execute($sql))
 die ($db->ErrorMsg());
 
if ($db->UpdateBlobFile('archivo2','the_blob',$_FILES['lob_upload']['tmp_name'],'id=' . $id))
{
$db->CompleteTrans();
echo "Blob successfully uploaded\n";
}
else
{
echo "Couldn't upload Blob\n";
$db->RollbackTrans();
}
 
Post Reply