title: How to send parameter to fileUploadListener in PrimeFaces fileUpload
body: <p>When I create a model I would like to save images for a model.  I am using PrimeFaces fileUpload component. When I save pictures I want to know to which model particular image refers to. That's why I need to send id of a model to backing bean.</p>
  
  <p><em>Is there any possibility to send <strong>id</strong> of model to <strong>fileUploadListener</strong>?</em></p>
  
  <pre><code>&lt;h:form enctype="multipart/form-data"&gt;
    &lt;p:panelGrid columns="2"&gt;
      &lt;h:outputLabel for="hotelName" value="#{msg.hotelName}"/&gt;
      &lt;p:inputText value="#{apartmentNew.name}" id="hotelName"/&gt;
      &lt;h:outputLabel for="hotelDescription" value="#{msg.hotelDescription}"/&gt;
      &lt;p:inputText value="#{apartmentNew.description}" id="hotelDescription"/&gt;
      &lt;h:outputLabel for="hotelImages" value="#{msg.hotelImages}"/&gt;
      &lt;h:form enctype="multipart/form-data"&gt;
        &lt;p:fileUpload id="hotelImages"
                      fileUploadListener="#{apartments.handleImageUpload}"
                      mode="advanced"
                      sizeLimit="10000000"
                      allowTypes="/(\.|\/)(gif|jpe?g|png)$/"&gt;
        &lt;/p:fileUpload&gt;
      &lt;/h:form&gt;
    &lt;/p:panelGrid&gt;
    &lt;p:commandButton id="saveApartmentButton" value="#{msg.save}" action="save"/&gt;
    &lt;p:commandButton id="cancelCreationApartmentButton" value="#{msg.cancel}" 
       action="cancel"/&gt;
  &lt;/h:form&gt;
  </code></pre>