File Upload/Display in OAS

From: Joel Racicot <joelracicot_at_home.com>
Date: 2000/05/13
Message-ID: <391D7DD3.D6BB0B78_at_home.com>#1/1


Hi Folks,

[Quoted] I've been struggling with the following problem for a few weeks and I'd like to run this by you all.

[Quoted] I need to upload a file (typically an image) to a table and then be able to retrieve and display it to a web page. All these actions occur through OAS.

[Quoted] The table is structured as follows:

Create table BLOBTEST (
[Quoted] name varchar2(100),
content BLOB);

[Quoted] I am able to retrieve the image from my table using the following procedure:

PROCEDURE Getimage

[Quoted] /* The calling proc (STORES) is passing the name of the image to be
retrieved from

   the image table BLOBTEST. */

(
[Quoted] p_id IN BLOBTEST.name%TYPE /* VENDORS.logo = BLOBTEST.content */ )

IS

[Quoted] l_lob  blob;                     /* BLOBTEST.content  */
l_amt NUMBER DEFAULT 30;
l_off NUMBER DEFAULT 1;
l_raw RAW(4096);

l_gif NUMBER(2);
l_jpg NUMBER(2);

BEGIN
[Quoted] /* Get the image from the BLOBTEST table based on the name that was
passed from the calling procedure. */

SELECT content
INTO l_lob
FROM BLOBTEST
[Quoted] WHERE name = p_id;

[Quoted] owa_util.mime_header('image/gif');

[Quoted] /* Pass the image out to the the browser. */

        BEGIN
                LOOP
                        dbms_lob.read( l_lob, l_amt, l_off, l_raw );
                        htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
                        l_off := l_off+l_amt;
      l_amt := 4096;
                END LOOP;
        EXCEPTION
                WHEN NO_DATA_FOUND THEN
      htp.prn('No image found');
        END;

END; [Quoted] I am also able to upload a file to OWS_CONTENT using the built-in packages granted to OWS_STANDARD_ROLE.

[Quoted] My problem is I haven't found how to extract the image from OWS_CONTENT to display on the web page and I haven't figured out how to load the image into the BLOBTEST table.

[Quoted] So, as you can see, I have half a solution using either option.

[Quoted] I am doing this on the side for a friend and I'd like to pick your brains to resolve this so my friend can move on.

[Quoted] The OWA_REPL cartridge, made available by Thomas Kyte, would probably do it for me, unfortunately, I have no access to the box to install this and apparently, according to the dba, there is no C compiler, therefore this option is unavailable to me.

[Quoted] Any help or thoughts you might be able to give me would be greatly appreciated.

Thanks

Joel Received on Sat May 13 2000 - 00:00:00 CEST

Original text of this message