?php / * This script demonstrates file upload to LOB columns * The formfield used for this example looks like this * form action=" upload.php "method="post" enctype="multipart / form-data "* input type="file" name="lob_upload "*... * / if(!isset($lob_upload) _BAR_ _BAR_ $lob_upload == 'none') {? form action="upload.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 / / see also the features section on file upload, / / if you would like to use secure uploads $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 - savefile($lob_upload)) {OCICommit($conn); echo "Blob successfully uploaded\n"; }else {echo "Couldn't upload Blob\n";} OCIFreeDesc($lob); OCIFreeStatement($stmt); OCILogoff($conn);}?
Le script efface * les lignes sélectionnées avec ROWID est valide les transactions * à chaque jeu de $commitsize lignes. (Attention: il n'y plus d'annulation) * / if(!isset($lob_upload) _BAR_ _BAR_ $lob_upload == 'none') {? form action="upload.php3 "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($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 - savefile($lob_upload)) {ociCommit($conn); echo "Blob sauvé!\n"; }else {echo "Impossible de sauver le Blob\n";} ociFreeDescriptor($lob); ociFreeStatement($stmt); ociLogoff($conn);}?