How to upload multiple files in apex collection using Oracle APEX.
- Create a blank page where there will be a page item and a button as per screenshot.
- Create a page process for uploading a multiple file to the database or apex collection.
declare
l_file_names apex_t_varchar2;
l_file apex_application_temp_files%rowtype;
begin
APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION(
p_collection_name=>'DOCUMENT'
);
l_file_names := apex_string.split (
p_str => :P28_DOC,
p_sep => ':' );
for i in 1 .. l_file_names.count loop
select *
into l_file
from apex_application_temp_files
where name = l_file_names(i) and APPLICATION_ID=:APP_ID;
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'DOCUMENT',
p_c001 => l_file.FILENAME,
p_c002 => l_file.MIME_TYPE,
p_blob001 => l_file.BLOB_CONTENT,
p_n001 => l_file.ID,
p_d001 => sysdate );
-- raise_application_error(-20001,l_file_names(i));
end loop;
end;
- To check uploaded record, use below query and set blob column attribute as per screenshot.
SELECT c001,
c002,
n001,
DBMS_LOB.GETLENGTH(blob001)IMG,
d001
FROM APEX_collections
where collection_name='DOCUMENT'