我想使用 primefaces fileUpload 上传 doc 或 docx 文件,尽管我指定了它显示的文件类型
文件类型无效
<p:fileUpload cancelLabel="#{contenu.annuler}"
fileUploadListener="#{utilAdminBean.fileUpload}"
allowTypes="/(\.|\/)(doc|docx)$/"
multiple="false" mode="advanced" sizeLimit="52428800"
showButtons="false" />
最佳答案
找到了解决办法,忘记在<h:form nctype="multipart/form-data">
里面的fileupload组件中添加
功能代码如下:
<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>
关于jsf - primefaces 文件上传无效的文件类型 doc, docx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17720985/