Download the file from the server db at the local level

Hi all

After the implementation of the procedure, I found here [http://docs.oracle.com/cd/E10513_01/doc/appdev.310/e10497/up_dn_files.htm#CHDECDAJ] I'm trying to use a different procedure to download directly from an oracle directory which is
PROCEDURE DOWNLOAD_PUBLIC_DIR (v_file_name varchar2) as
     v_length     number;
    bf BFILE;
    Lob_loc     blob;                     
    v_mime          varchar2(255);
    vexists BOOLEAN;
     vfile_length NUMBER;
     vblocksize NUMBER;
begin
     UTL_FILE.FGETATTR('PUBLIC_DIR',v_file_name,vexists,vfile_length,vblocksize);
     if vexists then
          DBMS_LOB.createtemporary (Lob_loc, TRUE, DBMS_LOB.SESSION);
          bf := BFILENAME('PUBLIC_DIR', v_file_name);
          DBMS_LOB.FILEOPEN(bf,dbms_lob.file_readonly);
          DBMS_LOB.LOADFROMFILE(Lob_loc, bf, DBMS_LOB.GETLENGTH(bf));
          DBMS_LOB.FILECLOSE(bf);
         owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
         htp.p('Content-length: ' || v_length);
         htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');
         owa_util.http_header_close;
         wpg_docload.download_file( Lob_loc );
     end if;
 end;
then run it
GRANT EXECUTE ON DOWNLOAD_PUBLIC_DIR TO PUBLIC
In my apex application, I create an element display only and on the label, I try to use this in the label
<a href="DOWNLOAD_PUBLIC_DIR?v_file_name='myFileOnDBServer.xls'">Download</a>
or even that in the source (as I already do in other parts of the application)
select '<a href="pspappweb.DOWNLOAD_PUBLIC_DIR?v_file_name='||'myFileOnDBServer.xls'||'">Download</a>' from dual
When I click on the link in the message to
Not Found
The requested URL /pls/apex/DOWNLOAD_PUBLIC_DIR was not found on this server.
I'm obviously missing?
Thank you all.
Alex

Published by: OraclePSP on November 29, 2012 5.58

Hi Alex,

This is probably because of the function of validation of request, in your mod_plsql DAD, EPG or Apex listener config. Beware of the wwv_flow_epg_include_modules.authorize. You can enable additional entry points by crushing the procedure APEX_040200 wwv_flow_epg_include_mod_local. It is described in apex/core/wwv_flow_epg_include_local.sql.

Kind regards
Christian

Tags: Database

Similar Questions

Maybe you are looking for