My allowedTypes in PrimeFaces p:fileUpload are not static.They depend on some parameter which is passed as request parameter to the page. So how to change allowedTypes dynamically according to that request parameter.
I just tried it with defining the allowedTypes via a bean property and that is working for me. So define a allowedTypes property in you bean
public String getAllowedTypes() {
return "/(gif|png)$/";
}
and call it in your page
<p:fileUpload fileUploadListener="#{fileUploadView.handleFileUpload}" mode="advanced" dragDropSupport="false"
update="rocomessages" sizeLimit="100000" fileLimit="3" allowTypes="#{fileUploadView.allowedTypes}" />