• Bheem

How restrict only PDF files for file browser in oracle apex.

In oracle apex file browser page item we can restrict the blob type by changing file type like below. So that it will allow only PDF files to browse from system.

What if user drags & drop the image or other blob type file. In this case system fails to restrict. we can fix this issue with following example.

Step 1: Set custom attribute for the file browser item as shown below.

Custom Attribute : accept=".pdf"

Step 2: Create Dynamic Action for page item as shown below.

Event : Change

Selection Type: Item

Item: File browser page item.

Step 3: Create True Action Execute JavaScript Code.

This java script code will check the filename through error message if file uploaded is not PDF.

var str = $v('P122_INV_BLOB');
var lastthree = str.substr(str.length -3)
lastthree = lastthree.toUpperCase();
if (lastthree !="PDF")

        type: apex.message.TYPE.ERROR,
        //location: ["page", "inline"],
        location: ["inline"],
        pageItem: "P122_INV_BLOB",
        message: "Please select valid pdf file",
        unsafe: false
    apex.item( "P122_INV_BLOB" ).setValue ('');

Step 4: Save & Run your page.

73 views0 comments

Recent Posts

See All

How to create network ACL in oracle database.

when you are calling third party API in oracle using UTL_HTTP then you will face Network access denied by ACL error if ACL is not created. To create ACLfirst login with sys account then run below code