primefaces fileupload invalid file type doc, docx

facelets, file-upload, jsf, primefaces

Solution

I found the solution,I forgot to add to the fileupload component inside `<h:form nctype="multipart/form-data">`

functional code is as follows:

<h:form id="formcontract" enctype="multipart/form-data" dir="rtl">
    <p:fileUpload cancelLabel="#{contenu.annuler}"
        fileUploadListener="#{utilAdminBean.fileUpload}"
        allowTypes="/(\.|\/)(doc|docx|xls|xlsx|pdf)$/"
        multiple="false" mode="advanced" sizeLimit="52428800"
        showButtons="false" />
</h:form>

Problem

I want to upload doc or docx file using primefaces fileUpload,although I specify the type of file it display Invalid file type ``` <p:fileUpload cancelLabel="#{contenu.annuler}" fileUploadListener="#{utilAdminBean.fileUpload}" allowTypes="/(\.|\/)(doc|docx)$/" multiple="false" mode="advanced" sizeLimit="52428800" showButtons="false" /> ```

Original source