Inserting image in a table using php +zend

Hy!
The table is
(products(picture_p blob,prod_id number)) when i try to insert the pictureusing a similar code with this from oracle .com:
// Insert the BLOB from PHP's tempory upload area
$lob = oci_new_descriptor($conn, OCI_D_LOB);
$stmt = oci_parse($conn, 'INSERT INTO BTAB (BLOBID, BLOBDATA) '
.'VALUES(:MYBLOBID, EMPTY_BLOB()) RETURNING BLOBDATA INTO :BLOBDATA');
oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
oci_bind_by_name($stmt, ':BLOBDATA', $lob, -1, OCI_B_BLOB);
oci_execute($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'])) {
oci_commit($conn);
else {
echo "Couldn't upload Blob\n";
$lob->free();
oci_free_statement($stmt);
// Now query the uploaded BLOB and display it
$query = 'SELECT BLOBDATA FROM BTAB WHERE BLOBID = :MYBLOBID';
$stmt = oci_parse ($conn, $query);
oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
oci_execute($stmt, OCI_DEFAULT);
$arr = oci_fetch_assoc($stmt);
$result = $arr['BLOBDATA']->load();
// If any text (or whitespace!) is printed before this header is sent,
// the text won't be displayed and the image won't display properly.
// Comment out this line to see the text and debug such a problem.
header("Content-type: image/JPEG");
echo $result;
oci_free_statement($stmt);
oci_close($conn); // log off
?>
I get an error -can't open file htdocs/ phpA.tmp
please if you have an idea from where it could be the error reply

It looks like your webserver doesn't have read permissions on the directory and files within it. In Linux, set it to 755, in Windows, I'm not sure what needs doing sorry.

Similar Messages

  • Inserting Images in a Table

    When I insert images in a table and align them right, for
    example, there are still a few pixels between the edge of the table
    and the image on the top and right.
    How do I make an image go to the absolute edge of a table?
    Thanks,
    Chris

    By managing the table's default cellpadding and cellspacing.
    Are you
    setting them to zero?
    If that's not happening then we would need to see your code.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "OxfordFishSalon" <[email protected]> wrote
    in message
    news:fulior$9i1$[email protected]..
    > When I insert images in a table and align them right,
    for example, there
    > are
    > still a few pixels between the edge of the table and the
    image on the top
    > and
    > right.
    >
    > How do I make an image go to the absolute edge of a
    table?
    >
    > Thanks,
    > Chris
    >

  • Replace words with images, in a table, using the search/replace tool

    Hello everybody
    I have a question:
    Is it possible to replace words with images, in a table, using the search/replace tool?
    My case:
    I have a table with about 9000 articles on about 400 pages. In this table there are words which I like to replace with Logos.
    Example: The word "DM" should be the Logo "DM" (.eps). This word is about 1200 times in this table.
    Is it possible to replace it automatically?
    Thank you very much for your helb.
    Kind regards Alex

    Hello Mr. Werner
    Thank you for your reply.
    Can I ask you which Version of InDesign do you use?
    I use CS 5.5 and there I can't find the change field "other" you told me.
    Can you see it on the screenshot? (Sorry it is german...)
    Thank you very much for your support.
    Kind regards Alex

  • How to insert images in a table

    Hi all,
    Iam working On Oracle10g
    can any one explain how to insert images in a table.
    Any help will be much appreciated!!
    Thanks.

    Hi,
    Try like this
    step1: Create a folder & place the image in it.
    for eg: place the image 'Sunset.jpg' in 'IMAGEFILE' folder of D drive
    Step2: Create a Directory in sql*plus as
    CREATE DIRECTORY IMAGEDIR AS 'D:\IMAGEFILE';
    Step3: Grant previlage to user
    GRANT READ ON DIRECTORY IMAGEDIR TO PUBLIC;
    Step4: Create the table in which you want to insert the image
    create table loadalbum
    (name varchar2(100),
    image blob)
    Step5: Create the procedure as
    declare
    l_blob blob;
    l_bfile bfile;
    begin
    insert into loadalbum values ( 'Sunset', EMPTY_BLOB() )
    returning image into l_blob;
    l_bfile := bfilename( 'IMAGEDIR', 'Sunset.jpg');
    dbms_lob.fileopen( l_bfile );
    dbms_lob.loadfromfile( l_blob, l_bfile, dbms_lob.getlength( l_bfile ) );
    dbms_lob.fileclose( l_bfile );
    end;
    Now you can know whether the image is inserted or not by
    SELECT COUNT(*) FROM LOADALBUM;
    COUNT(*)
    1
    which means image is inserted.
    Hope this may help you.

  • Inserting rows in 2 tables using a single query

    Can we insert values in two tables using a single INSERT query?

    Yes we can insert data in multiple tables using (Multiple insert statement (oracle 9i New Feature))in a single statement.
    ex:
    INSERT ALL
    INTO sal_history VALUES(empid,hiredate,sal)
    INTO mgr_history VALUES(empid,mgr,sysdate)
    SELECT employee_id EMPID, hire_date HIREDATE, salary SAL, manager_id MGR
    FROM employees;
    sncr
    Naresh

  • How to select data from 3rd row of Excel to insert into Sql server table using ssis

    Hi,
    Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.

                                                         CUSTOMER DETAILS
                         REGION
    COL1        COL2        COL3       COL4           COL5          COL6          COL7
           COL8          COL9          COL10            COL11      
    1            XXX            yyyy         zzzz
    2            XXX            yyyy        zzzzz
    3           XXX            yyyy          zzzzz
    4          XXX             yyyy          zzzzz
    First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
    Set range within Excel command as per below
    See
    http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Insert image into a .pdf using InDesign

    Can I insert image into a .pdf using InDesign....

    You can place a PDF as an image in InDesign, then add more content and export a new PDF.
    There are also commercial plugins available that will allow you to open a PDF as editable objects in InDesign.

  • Can select, but cannot insert into oracle tables using php.

    I am having trouble inserting data into a tables in oracle using PHP. I can insert into the tables using baninst1, but nothing else. I can't even insert using the tables' owner. Every time I try I get the ORA-00492 error of table or view does not exist. However, I can run a select statement just fine. So far, baninst1 is the only user that can actually do inserts. I've triple checked all the table grants and everything is fine. Also, I can copy/paste the exact insert statement into SQL*Plus and it works with the correct user. It doesn't have to be baninst1. I've tried everything I can think of. I've tried putting the table name in quotes, adding the schema name to the table, checking public synonyms, but everything appears to be ok. I would greatly appreciate any suggestions others may have.
    I'm using PHP 5.2.3 with an oracle 9i DB.

    Here is the code that doesn't work. It works only with baninst1, no other username will work and all I do is change the my_username/my_password to something different. This is one example function where I try to do an insert, but it doesn't work on any of the tables I try.
    Thanks for looking.
    class Oracle {
         private $oracleUser = "my_username";
         private $oraclePassword = "my_password";
         private $oracleDB = "MY_DB";
         private $c = null;
         function Connect() {
              if ( !($this->c = ocilogon( $this->oracleUser, $this->oraclePassword, $this->oracleDB ) ) )
                   return false;
              return true;
         function AddNewTest($testName, $course, $section, $term, $maxAttempts, $length, $startDate, $startTime, $endDate, $endTime)
              $result = "";
              if( $this->c == null )
                   $this->Connect();     
              $splitIndex = strpos($course, " ");
              $subjectCode = substr($course, 0, $splitIndex);
              $courseNumber = substr($course, $splitIndex + 1);
              $insertStatment = "insert into szbtestinfo(szbtestinfo_test_name,
                                                                szbtestinfo_course_numb,
                                                           szbtestinfo_section,
                                                                szbtestinfo_max_attempts,
                                                                szbtestinfo_length_minutes,
                                                                szbtestinfo_start,
                                                                szbtestinfo_end,
                                                                szbtestinfo_id,
                                                                szbtestinfo_subj_code,
                                                                szbtestinfo_eff_term)
                                                                values( '" . $testName .
                   "', '" . $courseNumber .
                   "', '" . $section .
                   "', " . $maxAttempts .
                   ", " . $length .
                   ", to_date('" . $startDate . " " . $startTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", to_date('" . $endDate . " " . $endTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", szsnexttest.nextval" .
                   ", '" . $subjectCode .
                   "', '" . $term . "')";
              //return $insertStatment;
              $s = OCIParse($this->c, $insertStatment);
              try
                   $result = OCIExecute($s);
              catch(exception $e)
              return $result;
         }

  • Inserting an image into a table using the iPad?

    I am trying to make an evidence table in pages. I need to insert photographs into a table, next to the related statement. Is it possible to insert a photograph into the table on an iPad as I obviously don't have the 'command' button that others are using. If this is possible I want to be able to insert the picture as a predefined size?

    Hi,
    Yes, you can do this by using the Word Edit Cell VI under Report Generation>>Word Specific>>Word Tables in your block diagram functions pallette.  After creating a table, you can edit specific cells and send the file path of the image saved on your computer to that specific cell.  I put together an example that I've attached here as well to help you out with this.
    Regards,
    Austin S.
    National Instruments
    Academic Field Engineer
    Attachments:
    RGTWordImageInTable.vi ‏14 KB

  • How to upload an image in a directory using PHP code generated by Dreamweaver?

    I have created a dynamic website with Dreamweaver and PHP, i have also created a insertform page using dreamweaver's 'Record Insertion Form Wizard' i have a field named prod_img in my MySQL database and on my form but this is a text field and i have to enter the path of the image directory to display it but this needs to have the image in the directory, i want to add a browse file field so that the image uploads to the directory by PHP.
    My code is as follows:
    <?php require_once('../Connections/dwtltd.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO special_offers (spec_img, spec_head, spec_desc, spec_call, spec_price, spec_rtn) VALUES (%s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['spec_img'], "text"),
                           GetSQLValueString($_POST['spec_head'], "text"),
                           GetSQLValueString($_POST['spec_desc'], "text"),
                           GetSQLValueString($_POST['spec_call'], "text"),
                           GetSQLValueString($_POST['spec_price'], "text"),
                           GetSQLValueString($_POST['spec_rtn'], "text"));
      mysql_select_db($database_dwtltd, $dwtltd);
      $Result1 = mysql_query($insertSQL, $dwtltd) or die(mysql_error());
      $insertGoTo = "../specialoffers.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_dwtltd, $dwtltd);
    $query_insertRS = "SELECT * FROM special_offers ORDER BY spec_id ASC";
    $insertRS = mysql_query($query_insertRS, $dwtltd) or die(mysql_error());
    $row_insertRS = mysql_fetch_assoc($insertRS);
    $totalRows_insertRS = mysql_num_rows($insertRS);
    ?>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
      <table align="center" cellpadding="5">
        <tr valign="baseline">
          <td align="right" nowrap="nowrap">Add Image:</td>
          <td><span id="sprytextfield1">
          <input type="text" name="spec_img" value="" size="32" />
          <span class="textfieldRequiredMsg">A value is required.</span></span></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Offer Heading:</td>
          <td><input type="text" name="spec_head" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Offer Description:</td>
          <td><input type="text" name="spec_desc" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Phone:</td>
          <td><input type="text" name="spec_call" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Price:</td>
          <td><input type="text" name="spec_price" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">RTN:</td>
          <td><input type="text" name="spec_rtn" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right"> </td>
          <td><input type="submit" value="Insert record" /></td>
        </tr>
      </table>
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    Help greatly appreciated.
    I have googled, yahooed, binged etc etc and tried many tutorials but nothing goes in my favor please do not suggest to search on search engines or websites.

    Years and months later, apparently Dreamweaver CC 2014 has a "File" Form object that has a text box and Browse button.  Now I'm looking for the part that does the actual upload (which is why I wound up here).  I'm sure by now you have found a way to resolve your issue, but there it is....

  • INSERTING IMAGE TO DATABASE TABLE

    please suggest me the simplest code of image insertion in the database table.

    this is an example:>
    public static void AddEmployee(
    string lastName,
    string firstName,
    string title,
    DateTime hireDate,
    int reportsTo,
    string photoFilePath,
    string connectionString)
    byte[] photo = GetPhoto(photoFilePath);
    using (SqlConnection connection = new SqlConnection(
    connectionString))
    SqlCommand command = new SqlCommand(
    "INSERT INTO Employees (LastName, FirstName, " +
    "Title, HireDate, ReportsTo, Photo) " +
    "Values(@LastName, @FirstName, @Title, " +
    "@HireDate, @ReportsTo, @Photo)", connection);
    command.Parameters.Add("@LastName",
    SqlDbType.NVarChar, 20).Value = lastName;
    command.Parameters.Add("@FirstName",
    SqlDbType.NVarChar, 10).Value = firstName;
    command.Parameters.Add("@Title",
    SqlDbType.NVarChar, 30).Value = title;
    command.Parameters.Add("@HireDate",
    SqlDbType.DateTime).Value = hireDate;
    command.Parameters.Add("@ReportsTo",
    SqlDbType.Int).Value = reportsTo;
    command.Parameters.Add("@Photo",
    SqlDbType.Image, photo.Length).Value = photo;
    connection.Open();
    command.ExecuteNonQuery();
    public static byte[] GetPhoto(string filePath)
    FileStream stream = new FileStream(
    filePath, FileMode.Open, FileAccess.Read);
    BinaryReader reader = new BinaryReader(stream);
    byte[] photo = reader.ReadBytes((int)stream.Length);
    reader.Close();
    stream.Close();
    return photo;
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Inserting data into one table using another table

    Hi i have 2 tables
    CREATE TABLE N_SET
    N_ST_ID NUMBER(38) NOT NULL, ---- PK
    N_ST_NM VARCHAR2(50 BYTE) NOT NULL,
    N_ST_DSC VARCHAR2(200 BYTE),
    DFTID NUMBER ------ FK
    CREATE TABLE RZ
    NST_ID NUMBER(38) NOT NULL, ---- FK
    RID NUMBER(38) NOT NULL, --- PK
    RNM VARCHAR2(30 BYTE) NOT NULL
    I entered the data into the N_SET table using sequence in column N_ST_ID (using procedure)
    Now i need to enter the data into RZ table where NST_ID should contain the value of N_SET.N_ST_ID
    so for this i've written another procedure
    but confused how to write the select statement to retrieve the above condition..
    Could you help me in this please...

    Hi,
    I have a table Target whose structure is
    create table employee
    id VARCHAR2(20),
    name VARCHAR2(20),
    employee_seq NUMBER not null
    -- Create sequence
    create sequence test_seq
    minvalue 1
    maxvalue 999999999999999999999999999
    start with 5
    increment by 1
    nocache
    cycle;
    create table emp
    id VARCHAR2(20)
    name VARCHAR2(20)
    INSERT INTO emp
    ( id, name )
    VaLUES ( '100','test1');
    commit;
    INSERT INTO emp
    ( id, name )
    VaLUES ( '100','test2');
    commit;
    i have to insert into the TARGET table the fsa value from
    SOURCE table along with the sequence number using sequence test_seq.nextval.
    INSERT INTO employee
    ( id, name, employee_seq )
    SELECT id, ename, ( select test_seq.nextval from dual )
    FROM emp ;

  • Disable image in Advanced Table using SPEL

    Hi All,
    I am trying to render the image in Advanced table conditionally using SPEL in a custom page.
    In the properties of Image bean, I added SPEL to render the Image conditionally.
    When user clicks on the image, a popup will be shown.
    It is working fine until this point, I am able to render the Image only for certain rows.
    But the images which are rendered conditionally are disabled.
    When I click on the image it does not show popup.
    Please help me in resolving this issue
    Thank you

    Hi Stammine,
    Thank you, I was able to fix this using Switcher.
    Kumar

  • Unable to insert the record to table using pre-insert & pre-update trigger

    Hi All,
    I have tried to insert and update the backend table using the pre-update and pre-insert triggers. But its not working for me. Please find below the code which i have used in the triggers.
    Pre-insert trigger:
    DECLARE
    v_cust_num_cnt NUMBER;
    BEGIN
              SELECT      COUNT(customer_number)
              INTO      v_cust_num_cnt
              FROM cmw_bc_mobile_number
              WHERE substr(customer_number,1,15)=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              IF      v_cust_num_cnt = 0 THEN
                        INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER
                                                                                                   ,MOBILE_NUMBER
    ,CREATION_DATE
    VALUES
    (substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15)
    ,:BLOCKNAME.MOBILE_NUMBER
    ,SYSDATE
    COMMIT;                                                                                                    
    END IF;          
    END;
    PRE_UPDATE TRIGGER:
    BEGIN
              IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
              UPDATE apps.cmw_bc_mobile_number
         SET mobile_number = :BLOCKNAME.MOBILE_NUMBER,
         creation_date = SYSDATE
              WHERE customer_number=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              COMMIT;
         END IF;
    EXCEPTION
              WHEN OTHERS THEN
                   NULL;     
    END;
    Please let someone assist in gettting it resolved.
    Regards,
    Raj.

    Just use MESSAGE (we don't know what fnd_message is, that is some custom code):
    message('v_cust_num_cnt='||v_cust_num_cnt);
    IF v_cust_num_cnt = 0 THEN
      message('Now inserting...');
      INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER... 
    else
      message('Nothing to insert');
    end if;

  • Unable to insert images in this forum using Mac OS

    I was unable to insert images using safari or firefox. I can navigate to the desired image but cannot choose it (its grayed out).
    Tried files with different extensions such as  .png .jpg .jpeg .tiff .bmp but to no avail.
    Any ideas?

    Hi guys,
    I'm testing this with my Mac.
    Cheers!
    KarlaDJR
    Attachments:
    hp-envy-17-3d.jpg ‏50 KB

Maybe you are looking for

  • Training and Event management.Process Flow..

    Hi, Experts, Can any body give me some notes on  Training and event management and process flow also like integration between ECC-6.0 to Non SAP 1.Training request 2.Appraisal documents for performance feedback 3.Tracking Feedback processes Pls help

  • Cleanly "Starting Over" with the Desktop Software (non-BES)

    Hi there, With the advances in the RIM Desktop Software, there have been many posts about the upgrade process resulting in less than functional situations. The process I recommend is to cleanly start completely over, cleaning all remnants of the Desk

  • ITunes seeing old phone as new phone

    After using my iPhone for several months iTunes is all of a sudden telling me "An iPhone has been previously synced with this computer" and asking me to set it up as a new phone or to restore it from a backup. It has never done this before. My iPhone

  • ORA-00314, ORA-00312 during restore

    Hi. I have (I should say I had) a database in archivelog mode. Arch logs multiplexed on c:, e:. Online redo logs multiplexed on c:, e:. Controlfile multiplexed on c:, e:. I also had a copy of spfile on e: I also made a backup on e: configure default

  • HT4623 iPod touch update.... Now white screen?

    I updated my sons iPod touch (4th Gen) a couple of days ago as per its request. It then asked me to plug into iTunes. When I plugged in, it said it needed to be restored from factory / back up. I tried this but iTunes kept coming up as needed to rest