alllist = List(); alllist = {"png","PNG","JPEG","jpeg","JPG","jpg","GIF","gif","BMP","bmp"}; var = ""; if(input.Attachment != null) { ext = input.Attachment.toList(".").get(input.Attachment.toList(".").size() - 1); } rpl = replaceAll(ext," border = \"0\"></img>",""); var = rpl.replaceAll("\"",""); if(!alllist.contains(var) && var != "") { alert "This file type is not accepted. Only PNG,JPG,JPEG,BMP file formats are allowed"; }