【问题标题】:p:fileupload image preview is not workingp:fileupload 图像预览不起作用
【发布时间】:2017-10-31 03:58:18
【问题描述】:

我在我的申请表中使用了主要面孔文件上传功能,每当我上传文件时,它都不会在屏幕上显示预览图像。

我想知道这个问题要引用哪个属性和类。请在下面找到示例代码。

<fileUpload
    id="uploadImage"
    fileLimit="1" 
    fileUploadListener="#{publicSarFormDataBean.handleFileUpload}"
    process="@form"
    mode="advanced"
    multiple="false"
    auto="true"  
    onstart="PF('statusDialog').show()"
    oncomplete="PF('statusDialog').hide(), PF('documentListTbl').filter()"
    dragDropSupport="true"
    sizeLimit="1000000000" 
    allowTypes="/(\.|\/)(png|jpeg|JPEG|jpg|JPG)$/"
    invalidFileMessage="File is invalid"
    update="messages"
    styleClass="Fleft FontBold">
</p:fileUpload>

【问题讨论】:

  • 请放更多代码,你想在数据表中显示图像吗??
  • 普通表单。它包含文本字段和提交按钮
  • 你想看一个裁剪的例子吗?
  • 把你p:graphicImage的代码...
  • 更好的是,创建一个minimal reproducible example

标签: jsf file-upload primefaces jsf-2


【解决方案1】:

“预览”仅在上传之前相关。而且由于您拥有auto="true",文件会自动上传,p:fileUpload 中的预览是无用的。

PrimeFaces upload showcase 中一切正常

【讨论】:

    猜你喜欢
    • 2013-08-31
    • 2016-12-13
    • 2013-12-24
    • 1970-01-01
    • 2021-04-14
    • 2018-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多