File Type Validation in Oracle APEX

Sometimes requirements come to check file type before uploading into the application to restrict the unusual file type.

Below steps will guide to check file type before uploading into database column and show an error message of wrong file type selection.

These steps will check whether the file is in JPG, JPEG and PNG format. If not, then error message will appear.

Step : Crete a validation on your file browse type item.(Here my page item name is P21_FILE_CONTENT)

Validation name – filetype_extension_validation

Validation type – Item matches Regular Expression

Regular Expression : ([0-9a-zA-Z :\\-_!@$%^&*()])+(.jpg|.JPG|.png|.PNG|.jpeg|.JPEG)$

Error Message : Upload only JPG, PNG, JPEG images only.

Vlidation add screen for file browse type item

If someone trying to upload file with other formats the error message will appear.

error message in apex screen

Now you can change this regular express to check other file types like PDF, CSV etc.

Thanks.

You may also like...

Leave a Reply

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