I have procedure:
create or replace PROCEDURE download_pdf_file(p_file in number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT file_ID, file_blob,DBMS_LOB.GETLENGTH(file_blob)
INTO v_file_name,Lob_loc,v_length
FROM pdf_files
WHERE file_id = 1;
--
-- 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
htp.flush();
htp.init();
owa_util.mime_header( nvl('application/pdf','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: inline; filename="some_file.pdf"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end download_pdf_file;
If I try this procedure:
begin
download_pdf_file(1);
end;
It gives me output (content of pdf file)
So I create test page with static content region. I put there source:
<embed src="#YUJK#.download_pdf_file?p_file=1" width="500" height="375">
And nothing.
Anyway, it can be anything.. like #asdfg#.dfgdfgdfgd?p_file=1" for Apext this is OK. So looks like this is the problem - how to check if APEX really gets this link?