1. Create File Browse Item
2. Goto Item >Advanced> Custom Attributes> Type Multiple (For selecting multiple data)
3. Create another text field to get File Name
4. Create Dynamic Action on File Browse Item
"Onchange" event JavaScript.
var x = document.getElementById("P30_DOCUMENTS");
vlength=x.files.length;
var txt = "";
$x("P30_FILE_NAME").value="";
if ('files' in x) {
for (var i = 0; i <vlength; i++) {
if (x.files.length == 0) {
txt = "Select one or more files.";
$x("P30_FILE_NAME").value="";
}
else{
txt += "<br><strong>" + (i+1) + ". file</strong><br>";
console.log("txt ="+txt );
var file = x.files[i];
if ('name' in file) {
txt += "name: " + file.name + "<br>";
$x("P30_FILE_NAME").value+=file.name;
}
if ('size' in file) {
txt += "size: " + file.size + " bytes <br>";
}
if(i!=vlength-1)
{
$x("P30_FILE_NAME").value+=",";
}
}
}
}
5. Create the Page Process to get the file from APEX_APPLICATION_FILES and Store it in a Temporary Table.
Code:
DECLARE
l_selected apex_application_global.vc_arr2;
lv_filename VARCHAR2 (100);
BEGIN
l_selected := apex_util.string_to_table (:p37_filename, ':');
FOR i IN 1 .. l_selected.COUNT
LOOP
lv_filename := l_selected (i);
BEGIN
INSERT INTO mul_file_attach
(file_id, filename, mime_type, file_content,file_size)
SELECT ID, lv_filename, mime_type, blob_content,DOC_SIZE
FROM apex_application_files
WHERE filename = lv_filename AND created_by = :app_user;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
raise_application_error (-20585, 'Error in Insertion' || SQLERRM);
END;
DELETE FROM apex_application_files
WHERE filename = lv_filename AND created_by = :app_user;
COMMIT;
END LOOP;
END;
Muhammad Abdul Qaium is a Database Engineer/Oracle Apex Developer/BI Developer (in Connecticut, USA) who is an Oracle Certified Cloud Architect Professional, OCI Autonomous DB specialist as well as Oracle Business Intelligence Foundation Suite 11g Certified Implementation Specialist with extensive expertise in Database design , PL/SQL, Oracle Apex, Microsoft SSIS, ETL, Power BI, Qlik Sense, BI Publisher, Jasper Report, OBIEE. Contact: qaiuminfo@gmail.com
Search This Blog
Subscribe to:
Post Comments (Atom)
Search String Inside Oracle Database Objects SQL
SELECT owner, name, type, line, text FROM dba_source WHERE instr(UPPER(text), UPPER('string')) > 0;
-
1. Make a Region with PL/SQL Dynamic Content type . ========== 2. Assign ID to the region using HTP.p ( <span id="TEST_ID...
-
Create Excel File From Classic Report in Oracle Apex Using Java Script 1. Upload File Download File 2. Copy Pest the Code <!DO...
Hello Muhammad.
ReplyDeleteI'm trying to do this example, but when I send the submit event, nothing happens. I don't know if I was missing something. I followed your steps, and finally add a button to do the submit. Do you have a working example to share? or any idea what I could miss in the instructions?