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

Is there any way to fire the basic <p:fileUpload> button (the one that shows a panel to select a file) on click of an image?


ANSWERS:


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:



 MORE:


 ? JSF composite component childrens
 ? JSF Composite component and selectItems
 ? JSF Recursive Composite Component
 ? JSF, Composite Component: method call with default attribute value as parameter
 ? JSF composite:actionSource in nested composite components
 ? JSF Backing Component - Composite Component - Stackoverflow Exception
 ? JSF Composite Component argument update
 ? Composite JSF component with converter
 ? JSF 2.2 Composite Component EditableValueHolder
 ? Cassandra export/forward data only once