我想使用primefaces fileUpload上传doc或docx文件,尽管我指定了它显示的文件类型无效的文件类型
<p:fileUpload cancelLabel="#{contenu.annuler}"
fileUploadListener="#{utilAdminBean.fileUpload}"
allowTypes="/(\.|\/)(doc|docx)$/"
multiple="false" mode="advanced" sizeLimit="52428800"
showButtons="false" />
我找到了解决方法,我忘了添加到里面的fileupload组件中 <h:form nctype="multipart/form-data">
功能代码如下:
<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>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句