简体   繁体   English

单击图像打开p:fileUpload的文件浏览面板

[英]Open file browse panel of p:fileUpload on click of an image

有没有办法在单击图像时触发基本<p:fileUpload>按钮(显示面板以选择文件的按钮)?

Just put the image in a label referring the input field. 只需将图像放在引用输入字段的标签中即可。

<h:form>
    <p:fileUpload id="file" mode="simple" ... />
    <h:outputLabel for="file">
        <p:graphicImage name="images/pic.png" />
    </h:outputLabel>
</h:form>

Do note that this works even if the input is hidden by CSS. 请注意,即使输入被CSS隐藏,这仍然有效。

See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM