user1729214
user1729214

Reputation: 31

Primefaces fileUpload allowTypes

allowTypes of my p:fileUpload don't work: I can upload any types of file... What is missing or what is wrong?

Here's my page code:

<p:fileUpload 
    id="fileUpload" 
    value="#{tcnBean.file}" 
    mode="simple" 
    allowTypes="/(\.|\/)(pdf|doc?x)$/" 
    sizeLimit="100000" 
    update="messages" 
    required="true" />

Thanks!

Upvotes: 3

Views: 11862

Answers (1)

hanan Ahmed
hanan Ahmed

Reputation: 442

allow type and size limit attributes does not work in simple mode.you should change the mode to advanced or remove simple because the Default mode of fileupload is advanced.,also you should take care of the Compatibility of browser when using Advanced file upload because some features of rich UI requires browser that implement HTML5 to work properly

Upvotes: 6

Related Questions