ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling
complimentary technical Workshops on Database Security for the first 30
Oracle Database customers located anywhere in North America, EMEA, LATAM, or
APAC that send an email to
asra_us@oracle.com. Request a Workshop for
your organization today.
Purpose
Provides an interface to download files, BLOBs and BFILEs for use with the PL/SQL Gateway
AUTHID
CURRENT_USER
Constants
Name
Data Type
Value
max_doctable_name_len
PLS_INTEGER
256
mimet_col_len
PLS_INTEGER
48
name_col_len
PLS_INTEGER
64
Data Types
TYPE parts_table IS TABLE OF VARCHAR2(256) INDEX BY BINARY_INTEGER;
Signals the PL/SQL Gateway of a file is to be downloaded to the client's browser
Overload 1
wpg_docload.download_file(
p_filename IN VARCHAR2,
p_bcaching IN BOOLEAN DEFAULT TRUE);
-- Unvalidated: From an internet source of unknown reliability
GRANT execute ON display_easy_image TO public;
CREATE OR REPLACE PROCEDURE display_easy_image( p_id NUMBER ) AS
s_mime_type VARCHAR2(48);
n_length NUMBER;
s_filename VARCHAR2(400);
lob_image BLOB;
BEGIN
SELECT mime_type, dbms_lob.getlength( blob_content ), filename, blob_content
INTO s_mime_type, n_length, s_filename, lob_image
FROM easy_image
WHERE image_id = p_id;
-- set the size so the browser knows how much it will be downloading.
owa_util.mime_header(NVL(s_mime_type, 'application/octet' ), FALSE);
htp.p('Content-length: ' || n_length);
-- The filename will be used by the browser if the users does a "Save as"
htp.p('Content-Disposition: filename="' || s_filename || '"');
owa_util.http_header_close;
-- Download the BLOB
wpg_docload.download_file(lob_image);
END display_easy_image;
/
Overload 2
wpg_docload.download_file(p_blob IN OUT NOCOPY BLOB);