Warning: this is based on the Apex 5.1 Early Adopter and details may change.
The standard File Upload item type is getting a nice little upgrade in Apex 5.1. By simply changing attributes on the item, you can allow users to select multiple files (from a single directory) at the same time.
In addition, you can now restrict the type of file they may choose, according to the MIME type of the file, e.g.
image/jpg. This file type restriction can use a wildcard, e.g.
image/*, and can have multiple patterns separated by commas, e.g.
Normally, to access the file that was uploaded you would query
APEX_APPLICATION_TEMP_FILES with a predicate like
name = :P1_FILE_ITEM. If multiple files are allowed, however, the item will be set to a comma-delimited list of names, so the suggested code to get the files is:
declare arr apex_global.vc_arr2; begin arr := apex_util.string_to_table(:P1_MULTIPLE_FILES); for i in 1..arr.count loop select t.whatever into your_variable from apex_application_temp_files t where t.name = arr(i); end loop; end;
You can play with a simple demo here: https://apexea.oracle.com/pls/apex/f?p=UPLOAD_DEMO&cs=JK64 (login as demo / demodemo).
If you want to support drag-and-drop, image copy&paste, load large files asynchronously, or restrict the maximum file size that may be uploaded, you will probably want to consider a plugin instead, like Daniel Hochleitner’s DropZone.