The files can also be compiled procedurally by adding them to a collection in a PL/SQL code block.
Simply add all files to the UC_DOWNLOAD_FILES
collection. This special collection will be created and removed accordingly by the plug-in. Just make sure to provide parameters p_c001
for the file name, p_c002
for the mime type, and p_blob001
or p_clob001
for the content.
apex_collection.add_member
( p_collection_name => 'UC_DOWNLOAD_FILES'
, p_c001 => 'README.md'
, p_c002 => 'text/plain'
, p_clob001 => 'This zip contains *all* application files!'
);
for f in (
select *
from apex_application_static_files
where application_id = :APP_ID
) loop
apex_collection.add_member
( p_collection_name => 'UC_DOWNLOAD_FILES'
, p_c001 => f.file_name
, p_c002 => f.mime_type
, p_blob001 => f.file_content
);
end loop;
-- pro tip: you can override the zip file name by assigning it to the apex_application.g_x01 global variable
apex_application.g_x01 := 'all_files.zip';