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!

Problem to download a blob file from an html email

672073Nov 24 2008 — edited Nov 26 2008
Hi

I have got a problem to download a blob file from an html email.

What I have done is a download procedure in oracle to download blob files from an apex application.
This procedure is called by a process in an apex page when i click on a download link in the page and it works good.

What i want to do now, is to call the procedure from an email.
So, i send an email with the download link.
The problem is that the procedure is called in an apex page, so an internet explorer (IE6) window open.

When i click on open or save file in internet explorer (File Download popup), the file is correctly downloaded.
But the opened internet explorer window doesn't close and the following message is displayed : "Action canceled" !

Does someone have any idea to bypass the opening of Internet Explorer or to close the window without warning message ("The Web page you are viewing is trying to close the window").

For information :
a. The page where is my procedure doesn't require authentication.

b. An example of link send by email : http://oratst:7728/pls/apex/f?p=101:10::DOWNLOAD:NO::P10_FIL_ID:1148

c. My calling process is a Before Header Process that run if the :REQUEST = 'DOWNLOAD'.
Code :
BEGIN
p_download_file(:P10_FIL_ID);
END;

d. There is the code of my oracle procedure :
CREATE OR REPLACE PROCEDURE PSDUSRA.p_download_file (p_file IN NUMBER)
AS
v_mime VARCHAR2 (48);
v_length NUMBER;
v_file_name VARCHAR2 (2000);
lob_loc BLOB;
v_code NUMBER;
v_errm VARCHAR2(100);
BEGIN
SELECT fil_mime_type, fil_content, fil_name, DBMS_LOB.getlength (fil_content)
INTO v_mime, lob_loc, v_file_name, v_length
FROM blob_file
WHERE fil_id = p_file;
OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
HTP.p ('Content-length: ' || v_length);
HTP.p ( 'Content-Disposition: attachment; filename="'
|| REPLACE (REPLACE (SUBSTR (v_file_name,
INSTR (v_file_name, '/') + 1
),
CHR (10),
NULL
),
CHR (13),
NULL
)
|| '"'
);
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (lob_loc);

EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1 , 100);

INSERT INTO log (log_type, log_description, log_error_code, log_error_message)
VALUES ('Error', 'Procedure p_download_file', v_code, v_errm);
COMMIT;
RAISE_APPLICATION_ERROR (-20000, v_errm);
END p_download_file;


I hope that i have given enough informations.
Thanks
Tony
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2008
Added on Nov 24 2008
5 comments
830 views