function save_logo()
 {
     $dbh = $this->db->conn_id;
     $fileName1 = $_FILES['image']['name'];
     $filename = './uploads/tmp/' . $fileName1;
     $fd = fopen($filename, 'r');
     if ($fd) {
         $blob = ibase_blob_import($dbh, $fd);
         fclose($fd);
         if (!is_string($blob)) {
             // import failed
             echo "Gagal Import File";
         } else {
             $query = "UPDATE PEMDA SET LOGO = ?";
             $prepared = ibase_prepare($dbh, $query);
             if (!ibase_execute($prepared, $blob)) {
                 // record update failed
                 echo "Gagal Simpan Logo";
             }
         }
     } else {
         // unable to open the data file
         echo "Tidak dapat membuka data";
     }
 }
Example #2
0
 /**
  * Convert a text value into a DBMS specific format that is suitable to
  * compose query statements.
  *
  * @param string $value text string value that is intended to be converted.
  * @param bool $quote determines if the value should be quoted and escaped
  * @param bool $escape_wildcards if to escape escape wildcards
  * @return string text string that represents the given argument value in
  *      a DBMS specific format.
  * @access protected
  */
 function _quoteLOB($value, $quote, $escape_wildcards)
 {
     $db =& $this->getDBInstance();
     if (PEAR::isError($db)) {
         return $db;
     }
     $connection = $db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     $close = true;
     if (is_resource($value)) {
         $close = false;
     } elseif (preg_match('/^(\\w+:\\/\\/)(.*)$/', $value, $match)) {
         if ($match[1] == 'file://') {
             $value = $match[2];
         }
         $value = @fopen($value, 'r');
     } else {
         $fp = @tmpfile();
         @fwrite($fp, $value);
         @rewind($fp);
         $value = $fp;
     }
     $blob_id = @ibase_blob_import($connection, $value);
     if ($close) {
         @fclose($value);
     }
     return $blob_id;
 }