note 14357 rejected and deleted from function.ocinewdescriptor.php by zak

From: Date: Fri, 27 Jul 2001 21:28:11 +0000
Subject: note 14357 rejected and deleted from function.ocinewdescriptor.php by zak
Groups: php.notes 
Request: Send a blank email to php-notes+get-15955@lists.php.net to get a copy of this message
The upload example does not seem to work for images, at least on Win32 where binary files are treated differently. The following does work: // $lob_upload contains the temporary filename of the uploaded file $image = fread(fopen($lob_upload, "rb"), filesize($lob_upload)); $conn = OCILogon($user, $password); $lob = OCINewDescriptor($conn, OCI_D_LOB); $stmt = OCIParse($conn,"insert into $table (id, the_blob) values (my_seq.NEXTVAL, EMPTY_BLOB()) returning the_blob into :the_blob"); OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); OCIExecute($stmt, OCI_DEFAULT); if($lob->save($image)){ OCICommit($conn); echo "Blob successfully uploadedn"; }else{ echo "Couldn't upload Blobn"; } OCIFreeDesc($lob); OCIFreeStatement($stmt); OCILogoff($conn);

« previous php.notes (#15955) next »