Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Ora Apex & external files (Ora Application Express 3.1.0.00.32, Windows XP Prof. V002 SP2 English)
Ora Apex & external files [message #347586] Fri, 12 September 2008 04:37 Go to next message
mezosi.jozsef
Messages: 1
Registered: September 2008
Location: Hungary
Junior Member
I have files (for example pdf. documents, for example 102.pdf) in the OS file system, in the directory C:\oradoc and

in Apex some information (for example the number of the file: 102) about each file.

What I want: I want to push a button in Apex page next to the 102 file and see in Acrobat Reader the 102.pdf file.

MSR
Re: Ora Apex & external files [message #348454 is a reply to message #347586] Tue, 16 September 2008 16:40 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
If you're using Oracle XE, then you'll be using the built in HTTP server (EPG - embedded PL/SQL gateway) and it can't access O/S level files directly.

If that's the case, you can load the file into a BLOB column or just load it into the XML DB where the rest of the Apex images reside. Load it into "i", "public" or whatever.

--create or replace directory ABC_DIR as 'C:\ABC\';
declare
        rv boolean;
      begin
        begin
          DBMS_XDB.DELETERESOURCE('/public/my_doc.pdf', DBMS_XDB.DELETE_FORCE);
        exception
          when others then null;
        end;
        rv := dbms_xdb.createResource('/public/my_doc.pdf',
           bfilename('ABC_DIR','my_doc.pdf'),nls_charset_id('AL32UTF8'));
        if not rv then raise_application_error (-20501, 'Failed to load PDF into XDB'); end if;
      end;

Check that you can access the file directly from the URL, then you can integrate in into a page later.

http://my-host:8000/public/my_doc.pdf

Previous Topic: SELECT INTO - value of variable after "too many rows" exception
Next Topic: Bind variables empty
Goto Forum:
  


Current Time: Fri Mar 29 02:29:55 CDT 2024