Hallo,
habe mich von den Amateuren hier hochgearbeitet.
Folgendes Problem : Ich muss eine generierte PDF Datei in eine Oracledatenbank hochladen.
Ich habe auf der Oracleseite eine Beispieldatei gefunden die das gut erklärt.
Dieses Script funktioniert.
Ändere ich aber jetzt das script so das er nur noch
die datei vom Server nehmen muss und in die DB
packen soll also :
in
so entsteht nur ein leerer Eintrag in der DB.
Jemand eine Idee woran das liegen kann ?
habe mich von den Amateuren hier hochgearbeitet.
Folgendes Problem : Ich muss eine generierte PDF Datei in eine Oracledatenbank hochladen.
Ich habe auf der Oracleseite eine Beispieldatei gefunden die das gut erklärt.
Code:
<?php // // Sample form to upload and insert data into an ORACLE CLOB column // using PHP's Oracle 8 API. // // Based on http://www.php.net/manual/en/functio...descriptor.php // modified to work on CLOBs and use register_globals = Off. // // Before running this script, execute these statements in SQL*Plus: // drop table myclobtab; // create table myclobtab (c1 number, c2 clob); // // Tested with PHP 4.3.3 against Oracle 9.2 // if (!isset($_FILES['lob_upload'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data"> Upload file: <input type="file" name="lob_upload"> <input type="submit" value="Upload"> </form> <?php } else { $myid = 1; // should really be a unique id e.g. a sequence number $conn = OCILogon('secret', 'secret', 'secret'); // Delete any existing CLOB so the query at the bottom // displays the new data #$query = 'DELETE FROM MYCLOBTAB'; #$stmt = OCIParse ($conn, $query); #OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS); #OCIFreeStatement($stmt); // Insert the CLOB from PHP's temporary upload area $lob = OCINewDescriptor($conn, OCI_D_LOB); $stmt = OCIParse($conn, "INSERT INTO \"tblArchiv\" (\"AR_Objekt\") VALUES(EMPTY_BLOB()) RETURNING \"AR_Objekt\" INTO :C2"); OCIBindByName($stmt, ':C2', $lob, -1, OCI_B_BLOB); OCIExecute($stmt, OCI_DEFAULT); // The function $lob->savefile(...) reads from the uploaded file. // If the data was already in a PHP variable $myv, the // $lob->save($myv) function could be used instead. if ($lob->savefile($_FILES['lob_upload']['tmp_name'])) { OCICommit($conn); echo "CLOB successfully uploaded\n"; } else { echo "Could not upload CLOB\n"; } $lob->free(); OCIFreeStatement($stmt); OCILogoff($conn); } ?>
Ändere ich aber jetzt das script so das er nur noch
die datei vom Server nehmen muss und in die DB
packen soll also :
Code:
if ($lob->savefile($_FILES['lob_upload']['tmp_name'])) {
Code:
if ($lob->savefile("a.pdf")) {
Jemand eine Idee woran das liegen kann ?
Kommentar