Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Download as "inline" not working - Apex 5.1x

Gor_MahiaAug 15 2017 — edited Aug 16 2017

Hi folks,

iam having 2 closely related stuff as stated below (pls ignore #2 its resolved),

1.

Iam trying to download a blob file from a custom table and render it within (inline) a region on a page.

so i created a region and placed the below reference to test with hard-coded ID,

<iframe src="f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=FILESOURCE:::FILE_ID:114874367581694610110789062347230824191&embedded=true" style="width:718px; height:700px;" frameborder="0"></iframe>

where

app ondemand process=FILESOURCE

app item =FILE_ID

and in the body of the above process iam enforcing "inline" as,

htp.p('Content-Disposition:  inline; filename="'...);

but instead its popping up with the download and not displaying as iframe within region.

Your help is appreciated...thanks.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++BELOW RESOLVED PLS IGNORE++++++++++++++++++++++++++++++++++++++++++++++++

2.

ive been using this great custom download procedure in Apex 4x but somehow if i apply the exact same code in Apex 5.1x with execute grant on the procedure it doesn't work.

here is the same steps ive been using: https://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CHDCGIEF

CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS

        v_mime  VARCHAR2(48);

        v_length  NUMBER;

        v_file_name VARCHAR2(2000);

        Lob_loc  BLOB;

BEGIN

        SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)

                INTO v_mime,lob_loc,v_file_name,v_length

                FROM oehr_file_subject

                WHERE id = p_file;

              --

              -- set up HTTP header

              --

                    -- use an NVL around the mime type and

                    -- if it is a null set it to application/octect

                    -- application/octect may launch a download window from windows

                    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );

                -- set the size so the browser knows how much to download

                htp.p('Content-length: ' || v_length);

                -- the filename will be used by the browser if the users does a save as

                htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');

                -- close the headers         

                owa_util.http_header_close;

                -- download the BLOB

                wpg_docload.download_file( Lob_loc );

end download_my_file;

/

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

iam getting the below error which i feel is related to security:

Forbidden

The requested operation is not allowed

but if i inspect the url reference it looks correct:

<a href="MY_WS.download_file?p_file=114971904102219659369598033186024583178"></a>

Any idea is appreciated...thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2017
Added on Aug 15 2017
4 comments
1,031 views