Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*connect to host*/
- $connect = oci_connect('system','radit','localhost/XE');
- $response = array();
- if($connect)
- {
- if(isset($_POST["title"]) && isset($_POST["images"]))
- {
- $title = $_POST["title"];
- $image = $_POST["images"];
- $query = "INSERT INTO images (TITLE, IMAGES) VALUES (:title, EMPTY_BLOB()) RETURNING field_lob_a INTO :LOB_A";
- $parse = oci_parse($connect, $query);
- $lob_a = oci_new_descriptor($connect, OCI_D_LOB);
- oci_bind_by_name($parse, ":title", $title);
- oci_bind_by_name($parse, ":LOB_A", $lob_a, -1, OCI_B_BLOB);
- if(!oci_execute($parse, OCI_DEFAULT))
- {
- $lob_a->save($lob_date_a);
- oci_commit($connect);
- $lob_a->free();
- $response["code"] = 1;
- $response["message"] = "Success";
- echo json_encode($response);
- }
- else
- {
- $response["code"] = 0;
- $response["message"] = "Failed! Can not insert query";
- echo json_encode($response);
- }
- }
- else
- {
- $response["code"] = 0;
- $response["message"] = "No parameter passed";
- echo json_encode($response);
- }
- }
- else
- {
- $response["code"] = 0;
- $response["message"] = "Can not connect to host";
- echo json_encode($response);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment