Adding blobs to Oracle

From: Date: Thu, 22 Jun 2000 17:06:31 +0000
Subject: Adding blobs to Oracle
Groups: php.db 
Request: Send a blank email to php-db+get-575@lists.php.net to get a copy of this message
Hi All, Having a bit of trouble with adding BLOBs to Oracle 8, and was wandering if anyone has managed to do it. I have read the example in function.ocinewdescriptor.html to no avail. Given a table create table upload ( id number(10), the_blob blob ); and running the PHP program: <?php /* This script demonstrates file upload to LOB columns * The formfield used for this example looks like this * <form action="upload.php3" method="post" enctype="multipart/form-data"> * <input type="file" name="lob_upload"> * ... */ if(!isset($lob_upload) || $lob_upload == 'none'){ ?> <form action="example.php" method="post" enctype="multipart/form-data"> Upload file: <input type="file" name="lob_upload"><br> <input type="submit" value="Upload"> - <input type="reset"> </form> <?php } else { // $lob_upload contains the temporary filename of the uploaded file $conn = OCILogon("webdb", "webdb"); $lob = OCINewDescriptor($conn, OCI_D_LOB); $stmt = OCIParse($conn,"insert into upload (id, the_blob) values('1', EMPTY_BLOB()) returning the_blob into :the_blob"); OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); OCIExecute($stmt); if($lob->savefile($lob_upload)) { OCICommit($conn); echo "Blob successfully uploaded<br>\n"; } else { echo "Couldn't upload Blob<br>\n"; } $lob->free(); OCIFreeStatement($stmt); OCILogoff($conn); } ?> It says: Warning: OCILobWrite: ORA-22990: LOB locators cannot span transactions in /home/httpd/html/djn/vnvi/example.php on line 30 Couldn't upload Blob Any ideas anyone? I'm stumped. David.

« previous php.db (#575) next »