Recently I was working on file upload in Oracle application express. I was using file browse and storing the file oracle database. I have created some item level validations to validate user input before adding the new record. In this particular section I wanted to force user to select only valid file. I have used very simple regular expression to accomplish this task.
I did not use any java script for this. I have created a page level validation and selected regular expression validation. Assuming that you are familiar with validation control in APEX. In the expression section I have just typed the following as I want user to select only those files got extension .EC0
^.+\.((EC0))$
You can allow more than one file types by adding extension in this expression like this –
^.+\.((EC0)¦(JPG)¦(GIF)¦(PNG))$
So this is very simple and no javaScript or hard coding required for this validation. Hope it helps someone who struggling.