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!

How to download files from the database file system

PedroMendezSep 8 2009 — edited Sep 9 2009
Hello everyone.

I´m trying to make a procedure to download a PDF file stored in the server file system of the database, and not inside the database. The procedure created is this:

create or replace
PROCEDURE PRT_PR_DOWNLOAD_FICH(v_file_name VARCHAR2
)

AS

v_length Number;
Lob_loc Bfile;

BEGIN

Lob_loc := bfilename('DIR_OBJ', v_file_name);
v_length := dbms_lob.getlength(Lob_loc);

owa_util.mime_header('application/octet', False);
htp.p('Content-length: ' || v_length);
htp.p('Content-Disposition: attachment; filename="' || SUBSTR(v_file_name, INSTR(v_file_name, '/') + 1) || '"');
owa_util.http_header_close;
wpg_docload.download_file(Lob_loc);

END PRT_PR_DOWNLOAD_FICH;

This procedure receive the name of the file to download and use the function wpg_docload.download_file(). The DIR_OBJ is a directory object with path in the server to the folder with the files i want to download.


I want to allow users to download PDF files stored in the database server file system, opening a Save/ Open window in the browser whenever the user click in a button. When the user click the button, the procedure is called and executed without any error but the Save/ Open window doesn't appear, instead the page it's simply reloaded, nothing happens.

Can anyone tell me what i am doing wrong and if this is the best way to download a file directly from the database server file system?

Best Regards Pedro
This post has been answered by jariola on Sep 9 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2009
Added on Sep 8 2009
4 comments
969 views