Ticker

6/recent/ticker-posts

How to Get Filename, File Size, File Type From File Browse in Oracle Apex - Javainhand Tutorial



Hello Friends,
In this Oracle APEX Tutorial, I will explain to you How to Get Filename, File Size, File Type From File Browse in Oracle Apex.

Basically, If we need some file information before uploading on the server then with the help of javascript we can get that of files information and set it into different items as well.

Let's Start to Follow the below step for Get Filename, File Size, File Type From File Browse in Oracle Apex.

How to Get Filename, File Size, File Type From File Browse in Oracle Apex


Step 1:- Create a Region with P6_FILE_BROWSE, P6_FILE_NAME, P6_FILE_SIZE, P6_FILE_TYPE Items below screenshot will help you.


Step 2:- Create P6_FILE_BROWSE is file browse type Item and reset of three display only 
Type Items.
Step 3:- Create a Change Dynamic Action below screenshot will help you.


Identification:- Get Filename,Size,Type
When:-Event>Change
Selection Type:- Items
Item(s):- P6_FILE_BROWSE
Client-side Condition:-Type
Item:-P6_FILE_BROWSE 

Step 4:- Create True Action below screenshot and code will help you.


Action>Choose  Execute Javascript Code
Code> 
var fp = $("#P6_FILE_BROWSE");
var lg = fp[0].files.length; // get length
var items = fp[0].files;
if (lg > 0) {
        for (var i = 0; i < lg; i++) {
            var fileName = items[i].name; // get file name
            var fileSize = items[i].size; // get file size 
            var fileType = items[i].type; // get file type
            apex.item( "P6_FILE_NAME" ).setValue( fileName, null, true );
            apex.item( "P6_FILE_SIZE" ).setValue( fileSize, null, true );
            apex.item( "P6_FILE_TYPE" ).setValue( fileType, null, true );
 }

}

Below Result Screenshot will help you.


If You Like How to Get Filename, Size, Type From File Browse in Oracle Apex Tutorial 
Please Like Share And Comment.

Demo URL:-

Post a Comment

3 Comments

  1. I have query how to make text file in specific folder and open it new window. similarly for PDF / CSV . Mob. 9820401229

    ReplyDelete
  2. how to make text file & open it in specific folder , same as pdf/csv. mob.9820401229

    ReplyDelete

If you have any doubts, Please let me know