Your on the correct path.
You could generate a zip file using the APEX_ZIP APIs (https://docs.oracle.com/database/apex-18.1/AEAPI/APEX_ZIP.htm ) and then download that zip file using something like what you posted.
Something like this:
declare l_zip_file blob; l_zip_mimetype varchar2(255) := 'application/zip'; l_zip_filename varchar2(255) := 'somefilename.zip'; begin --add all files to the zip for l_file in (select doc, mimetype, filename, url from document) loop apex_zip.add_file ( p_zipped_blob => l_zip_file, p_file_name => l_file.filename, p_content => l_file.doc ); end loop; --finish the zip file apex_zip.finish (p_zipped_blob => l_zip_file ); --download the zip file sys.htp.init; sys.owa_util.mime_header( l_zip_mimetype , false ); sys.htp.p('Content-Disposition: attachment; filename="' || l_zip_filename ||'"'); sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( l_zip_file )); sys.owa_util.http_header_close; sys.wpg_docload.download_file(l_zip_file); -- Stop page processing apex_application.stop_apex_engine; end;
Thanks Max, but my question states not using zip
Umong other things, the application is in APEX 4.2 ... apex_zip is not available in APEX 4.2
I'm pretty sure the Hyper Text Transfer Protocol (HTTP) does not support a Response containing multiple files. Even if it did, you will be at the mercy of the web browser for "how is it handled".
- Download each file independently
- TAR/ZIP the multiple files and send that as a single file
- develop (and use) a "download manager"
- You just need to create a single file that contains the list of "files to download" and send that
If you go with the ZIP option, have a look at the "Alexandria PL/SQL Utility Library" GitHub repository.
There is a package to generate ZIP files, it's almost the same as the one you get with APEX.