Hi,
We are using APEX23.1.
I have a normal page and a button.
The button pops up a modal page which has only a select list item(shows file type to download) and a button (This submits the page). After we select the file and submit page, The following code downloads the file. This code is in Processing section
DECLARE
l_file_id NUMBER := to_number(:P301_FILE_ID);
l_file_blob BLOB;
l_file_name apex_application_files.filename%TYPE := 'output.pptx';
l_file_mimetype apex_application_files.mime_type%TYPE := 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
BEGIN
l_file_blob := my_func_get_file_blob(l_file_id);
sys.owa_util.mime_header(l_file_mimetype, FALSE);
sys.htp.p('Content-Disposition: attachment; filename="' || l_file_name || '"');
sys.htp.p('Content-length: ' || sys.dbms_lob.getlength(l_file_blob));
sys.owa_util.http_header_close;
sys.wpg_docload.download_file(l_file_blob);
-- Stop page processing
apex_application.stop_apex_engine;
END;
The download works fine.
I have another process Close Modal after this. But that doesnot get executed because of apex_application.stop_apex_engine;
I have setting at page level - Advanced → Reload on Submit → Always (If I use only on success I get Error: SyntaxError: Unexpected token 'P', "PK"... is not valid JSON )
How to close the modal after download? Please suggest.
Thanks.