Here I am giving an example to display the external file in a region in Oracle Apex.
In Oracle, you can access external files using the Oracle directory object. Suppose you have the external files on the server directory
/oracle/usr/emp/docs, then you should have a directory object created for this path. Below is an example of creating an Oracle Directory:
Create Directory emp_docs as '/oracle/usr/emp/docs'; Grant read, write on emp_docs to yourUsername;
Display External Files in a Region in Oracle Apex Example
Now to access the files from the above directory and display them in a region in Oracle Apex, create an Application Process as Ajax Callback and add the following PL/SQL code in it:
Ajax Application Process name: download_extfile.
Declare lob_loc Bfile; v_mime Varchar2(50) Default 'application/pdf'; vblob Blob; Begin lob_loc := BFILENAME (UPPER ('EMP_DOCS'), 'YourPDF.pdf'); vblob := to_blob(lob_loc); owa_util.mime_header( v_mime, false ); htp.p('Content-Length: ' || dbms_lob.getlength(vblob)); owa_util.http_header_close; wpg_docload.download_file(vblob); End;
After creating the Ajax callback process, create a region as URL type in your page, then click on the attribute tab, and in the URL field, paste the following URL:
In the IFrame attribute field, paste the below code:
You can set the height and width according to your needs.