Categorias
iiiiii
dowload blob apex
Descripcion
Descargar un archivo blob desde apex por medio de
html
declare
vch_file_name_default VARCHAR2(200) := 'miarchivo.xml';
vb_logo BLOB;
vch_file_name VARCHAR2(1000);
vch_mime_type VARCHAR2(200) := 'application/xml';
begin
BEGIN
select output_file
into
vb_logo
from tb_utl_psheet_transfer
where PSHEET_TRANSFER_ID = 1;
END;
/*
owa_util.mime_header( vch_mime_type, FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="Contrato-Cargo.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
*/
sys.htp.init;
sys.owa_util.mime_header(vch_mime_type , FALSE );
sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( vb_logo));
sys.htp.p('Content-Disposition: attachment; filename="' || vch_file_name_default || '"' );
sys.htp.p('Cache-Control: max-age=3600'); -- tell the browser to cache for one hour, adjust as necessary
sys.owa_util.http_header_close;
sys.wpg_docload.download_file( vb_logo );
--apex_application.stop_apex_engine;
end;