primefaces fileupload无效的文件类型doc,docx [英] primefaces fileupload invalid file type doc, docx

查看:217
本文介绍了primefaces fileupload无效的文件类型doc,docx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用primefaces fileUpload上传doc或docx文件,虽然我指定了它显示的文件类型
无效的文件类型



 < p:fileUpload cancelLabel =#{contenu.annuler}
fileUploadListener =#{utilAdminBean.fileUpload}
allowTypes = /(\.|\/)(doc|docx)$/
multiple =falsemode =advancedsizeLimit =52428800
showButtons =false/>


解决方案

我找到了解决方法,我忘了添加到< h:form nctype =multipart / form-data>



中的fileupload组件如下:
$ b

< h:form id =formcontractenctype =multipart / form -datadir =rtl>
fileUploadListener =#{utilAdminBean.fileUpload}
allowTypes =/(\。| \ /) (doc | docx | xls | xlsx | pdf)$ /
multiple =falsemode =advancedsizeLimit =52428800
showButtons =false/>
< / h:表格>


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" />

解决方案

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>

这篇关于primefaces fileupload无效的文件类型doc,docx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆