简体   繁体   中英

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.

See also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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