Search code examples
jsffile-uploadicefacesfile-type

How to give multiple values in fileNamePattern in ice:inputFile


I would like to know how to give multiple values in fileNamePattern in ice:inputFile, I need to add csv and txt file formats as the acceptable ones. But I am not allowed to give two values. I have tried giving ".+.txt",".+.csv" but it didnt help.suggestions please.

<ice:inputFile label="Upload" immediate="true"
submitOnUpload="postUpload" id="filename"
file="#{importAnalysisResultsModelBean.uploadFile}"
style="width:395px;" buttonClass="button"
fileNamePattern=".+\.txt"
uploadDirectory="#{globalController.uploadDirectory}/ssc/"
uploadDirectoryAbsolute="true"
actionListener="#{importAnalysisResultsBackingBean.importActionListener}" />

Solution

  • I discovered this works best for me :

    fileNamePattern="(.+\.csv)|(.+\.xls)|(.+\.xml)|(.+\.html)|(.+\.htm)"