Apex download file with file extension
1. Create procedure for download file
3. Create Button "DOWNLOAD" and set to Submit page.
4. create branch that condition is when button pressed is "DOWNLOAD", with request value "DOWNLOAD_FILE" and redirect to the same page where is that process before header.
procedure p_download_file(p_file_id number) is2. create process before header with condition so that process not always execute (REQUEST value)
v_blob_length number;
v_filename varchar2(2000);
v_blob_file blob;
begin
-- clear apex headers
sys.htp.init;
-- get blob loength, file_name,extension
select dbms_lob.getlength(rrt.file_blob)
,rrt.name || '.' || lower(rrt.extension)
,rrt.file_blob
into v_blob_length
,v_filename
,v_blob_file
from FILE_TABLE rrt
where rrt.id = p_file_id;
owa_util.mime_header('application/octet-stream', false);
sys.htp.p('Content-lenght:' || v_blob_length);
sys.htp.p('Content-disposition: attachment; filename="' || v_filename || '"');
owa_util.http_header_close;
wpg_docload.download_file(v_blob_file);
end;
3. Create Button "DOWNLOAD" and set to Submit page.
4. create branch that condition is when button pressed is "DOWNLOAD", with request value "DOWNLOAD_FILE" and redirect to the same page where is that process before header.
It works! Thank you so much!
ReplyDeletewhat is 'FILE_TABLE' in above procedure code ???
ReplyDeleteuser table where BLOB (FILE) is stored.
DeleteThis comment has been removed by the author.
ReplyDeletepresmenYcast-mu1978 Sima Lenz https://wakelet.com/wake/-glsjtqFTI8kB69RyznXD
ReplyDeleterecnalime
Ncaotiroko_Omaha Shannon Baker SONY Vegas
ReplyDeleteAdobe Acrobat Pro DC
WinZip
bandmadmipha