3

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!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user1729214
  • 31
  • 1
  • 1
  • 2
  • What version of Primefaces are you using, and what you mean `i can upload any types of file`, this mean you can upload succesfully to server or you can select any types when you choose a file ? – Rong Nguyen Jun 07 '13 at 16:07
  • see http://stackoverflow.com/questions/15282784/primefaces-3-5-uploadfile-not-working-i-using-netbean-7-2-1 – meyquel Jun 07 '13 at 17:30

1 Answers1

6

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

hanan Ahmed
  • 442
  • 3
  • 5