File Upload Improvements in APEX 5.1

Updated 10/10/2017 now that APEX 5.1 has been out for a while.


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. image/png,application/pdf.


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 colon-delimited list of names, so the suggested code to get the files is:

  arr apex_global.vc_arr2;
  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 = arr(i);
  end loop;

You can play with a simple demo here: . (UPDATE 10/10/2017: recreated demo on If you want to install the demo app yourself, you may copy it from here.

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.

Interactive Grids (APEX 5.1 EA) and TAPIs
Send SMS, MMS and Voice messages from Oracle PL/SQL


  1. The link to the demo does not work….

    • That’s because it’s on the Early Access site which gets wiped from time to time. I suspect 5.1 will be released soon though 🙂

  2. Thanks!
    But how to view/display a pdf file from report?

  3. Thanks for showing these new attributes off.

    Do you have any idea if they’ve enhanced the display of the resulting tag so it will display file names longer than 30 characters? I’ve found that annoying for a long time.

  4. Hi Stew,

    I believe you can change it by setting the width attribute, although I’m not sure if this works the same across all browsers.

    e.g. in my demo I’ve set Custom Attributes to style="width:500px"


  5. houshmand rastin
    11 October 2017 - 1:28 pm


    why on upload file not show image or preview befor insert into table?
    or how show preview image for upload file?

    • Hi houshmand rastin,

      If you would like to show a preview of the image, I recommend using the DropZone plugin which has this feature built-in.


  6. How can i get the code of the application ?

  7. Hi, great work. Thanks lot.

    I suggest to use unique identifier number for ID

    l_random_file_id :=to_number(sys_guid(), ‘XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’);

    if you want the UUID in the canonical format 8-4-4-4-12 36 characters
    this functions may be useful.

    CREATE OR REPLACE function OPEN_PA.uuidN_to_uuid ( pNumber in number) return PA_DEFS.UUID36_TYPE is
    –PA_DEFS.UUID36_TYPE is varchar2(36 byte) parameter.
    return trim(lower( regexp_replace((to_char(pNumber,’0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’)),'([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})’, ‘\1-\2-\3-\4-\5′)));
    when others then
    return null;
    end ;

    CREATE OR REPLACE function OPEN_PA.uuid_to_uuidn ( puuid in varchar2) return number is
    return to_number ( replace(puuid,’-‘,”),’XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX’ );
    when others then
    return null;
    end ;

Leave a Reply

Your email address will not be published / Required fields are marked *